Skip to content

Commit

Permalink
fix ambiguity warnings trunc(BigInt,::Float16)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbyrne committed Oct 1, 2015
1 parent 966850c commit b6409e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions base/gmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,18 @@ end
convert(::Type{BigInt}, x::Bool) = BigInt(UInt(x))


function unsafe_trunc(::Type{BigInt}, x::CdoubleMax)
function unsafe_trunc(::Type{BigInt}, x::Union(Float32,Float64))
z = BigInt()
ccall((:__gmpz_set_d, :libgmp), Void, (Ptr{BigInt}, Cdouble), &z, x)
return z
end

function convert(::Type{BigInt}, x::CdoubleMax)
function convert(::Type{BigInt}, x::Union(Float32,Float64))
isinteger(x) || throw(InexactError())
unsafe_trunc(BigInt,x)
end

function trunc(::Type{BigInt}, x::CdoubleMax)
function trunc(::Type{BigInt}, x::Union(Float32,Float64))
isfinite(x) || throw(InexactError())
unsafe_trunc(BigInt,x)
end
Expand Down

0 comments on commit b6409e2

Please sign in to comment.