Skip to content

Commit de47acb

Browse files
authored
Merge pull request #82 from JuliaGraphics/teh/isapprox
Rely on ColorTypes for isapprox
2 parents 39cd626 + 83f203b commit de47acb

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

REQUIRE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
julia 0.6
22
Colors 0.7.1
3-
ColorTypes 0.4
3+
ColorTypes 0.6.3
44
FixedPointNumbers 0.3.0
55
StatsBase 0.8.2
66
Compat 0.18.0

src/ColorVectorSpace.jl

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,14 +264,10 @@ norm(c::TransparentGray) = sqrt(abs2(c))
264264
isless(g1::AbstractGray, g2::AbstractGray) = isless(gray(g1), gray(g2))
265265
isless(c::AbstractGray, r::Real) = isless(gray(c), r)
266266
isless(r::Real, c::AbstractGray) = isless(r, gray(c))
267-
Base.isapprox(x::AbstractGray, y::AbstractGray; kwargs...) = isapprox(gray(x), gray(y); kwargs...)
268-
Base.isapprox(x::TransparentGray, y::TransparentGray; kwargs...) = isapprox(gray(x), gray(y); kwargs...) && isapprox(alpha(x), alpha(y); kwargs...)
269-
Base.isapprox(x::AbstractRGB, y::AbstractRGB; kwargs...) = isapprox(red(x), red(y); kwargs...) && isapprox(green(x), green(y); kwargs...) && isapprox(blue(x), blue(y); kwargs...)
270-
Base.isapprox(x::TransparentRGB, y::TransparentRGB; kwargs...) = isapprox(alpha(x), alpha(y); kwargs...) && isapprox(red(x), red(y); kwargs...) && isapprox(green(x), green(y); kwargs...) && isapprox(blue(x), blue(y); kwargs...)
271267

272268
function Base.isapprox{Cx<:MathTypes,Cy<:MathTypes}(x::AbstractArray{Cx},
273269
y::AbstractArray{Cy};
274-
rtol::Real=Base.rtoldefault(eltype(Cx),eltype(Cy)),
270+
rtol::Real=Base.rtoldefault(eltype(Cx),eltype(Cy),0),
275271
atol::Real=0,
276272
norm::Function=vecnorm)
277273
d = norm(x - y)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ end
112112
@test isapprox(a, a)
113113
@test real(Gray{Float32}) <: Real
114114
@test zero(ColorTypes.Gray) == 0
115-
@test one(ColorTypes.Gray) == 1
115+
@test oneunit(ColorTypes.Gray) == 1
116116
a = Gray{N0f8}[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0]
117117
@test StatsBase.histrange(a,10) == 0.1f0:0.1f0:1f0
118118

0 commit comments

Comments
 (0)