Skip to content

Commit

Permalink
Merge pull request #74 from JuliaMath/teh/amb
Browse files Browse the repository at this point in the history
Fix an ambiguity on julia 0.6
  • Loading branch information
vchuravy authored Feb 11, 2017
2 parents 9a1b40a + 3bf4701 commit 872675d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/normed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ zero(x::Normed) = zero(typeof(x))
rawone(v) = reinterpret(one(v))

# Conversions
convert{T<:Normed}(::Type{T}, x::T) = x
convert{T<:Unsigned,f}(::Type{Normed{T,f}}, x::Normed{T,f}) = x
convert{T1<:Unsigned,T2<:Unsigned,f}(::Type{Normed{T1,f}}, x::Normed{T2,f}) = Normed{T1,f}(convert(T1, x.i), 0)
function convert{T<:Unsigned,T2<:Unsigned,f}(::Type{Normed{T,f}}, x::Normed{T2})
U = Normed{T,f}
Expand All @@ -45,7 +45,6 @@ function convert{T<:Unsigned,T2<:Unsigned,f}(::Type{Normed{T,f}}, x::Normed{T2})
reinterpret(U, _unsafe_trunc(T, y))
end
convert{U<:Normed}(::Type{U}, x::Real) = _convert(U, rawtype(U), x)
convert{T1,T2,f}(::Type{Normed{T1,f}}, x::Normed{T2,f}) = Normed{T1,f}(convert(T1, x.i), 0)

convert(::Type{N0f16}, x::N0f8) = reinterpret(N0f16, convert(UInt16, 0x0101*reinterpret(x)))
function _convert{U<:Normed,T}(::Type{U}, ::Type{T}, x)
Expand Down
1 change: 1 addition & 0 deletions test/normed.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ end
@test_throws ArgumentError convert(Normed{UInt128,100}, 10.0^9)

x = N0f8(0.5)
@test convert(N0f8, x) === x
@test isfinite(x) == true
@test isnan(x) == false
@test isinf(x) == false
Expand Down

0 comments on commit 872675d

Please sign in to comment.