Skip to content

Commit

Permalink
Comment out BigInt(::Int128) pending JuliaLang#2368
Browse files Browse the repository at this point in the history
also BigInt(::Uint128) and corresponding BigFloat constructors
  • Loading branch information
carlobaldassi committed Feb 20, 2013
1 parent fda3e4a commit 9a4a824
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions base/bigfloat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ end
BigFloat(x::Bool) = BigFloat(uint(x))
BigFloat(x::Signed) = BigFloat(int(x))
BigFloat(x::Unsigned) = BigFloat(uint(x))
BigFloat(x::Int128) = BigFloat(BigInt(x))
BigFloat(x::Uint128) = BigFloat(BigInt(x))
#BigFloat(x::Int128) = BigFloat(BigInt(x))
#BigFloat(x::Uint128) = BigFloat(BigInt(x))
if WORD_SIZE == 32
BigFloat(x::Int64) = BigFloat(string(x))
BigFloat(x::Uint64) = BigFloat(string(x))
Expand All @@ -59,7 +59,7 @@ BigFloat(x::Float32) = BigFloat(float64(x))
BigFloat(x::Rational) = BigFloat(num(x)) / BigFloat(den(x))

convert(::Type{BigFloat}, x::Rational) = BigFloat(x) # to resolve ambiguity
convert{T<:Real}(::Type{BigFloat}, x::T) = BigFloat(x)
convert(::Type{BigFloat}, x::Real) = BigFloat(x)

convert(::Type{Float64}, x::BigFloat) = ccall((:__gmpf_get_d,:libgmp), Float64, (Ptr{Void},), x.mpf)

Expand Down
4 changes: 2 additions & 2 deletions base/bigint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ end
BigInt(x::Bool) = BigInt(uint(x))
BigInt(x::Signed) = BigInt(int(x))
BigInt(x::Unsigned) = BigInt(uint(x))
BigInt(x::Int128) = BigInt(string(x))
BigInt(x::Uint128) = BigInt(string(x))
#BigInt(x::Int128) = BigInt(string(x))
#BigInt(x::Uint128) = BigInt(string(x))
if WORD_SIZE == 32
BigInt(x::Int64) = BigInt(string(x))
BigInt(x::Uint64) = BigInt(string(x))
Expand Down
8 changes: 4 additions & 4 deletions test/bigfloat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ d = BigFloat("-24.69135780242")
@test typeof(BigFloat(typemax(Int16))) == BigFloat
@test typeof(BigFloat(typemax(Int32))) == BigFloat
@test typeof(BigFloat(typemax(Int64))) == BigFloat
@test typeof(BigFloat(typemax(Int128))) == BigFloat
#@test typeof(BigFloat(typemax(Int128))) == BigFloat

@test typeof(BigFloat(true)) == BigFloat
@test typeof(BigFloat(typemax(Uint8))) == BigFloat
@test typeof(BigFloat(typemax(Uint16))) == BigFloat
@test typeof(BigFloat(typemax(Uint32))) == BigFloat
@test typeof(BigFloat(typemax(Uint64))) == BigFloat
@test typeof(BigFloat(typemax(Uint128))) == BigFloat
#@test typeof(BigFloat(typemax(Uint128))) == BigFloat

@test typeof(BigFloat(realmax(Float32))) == BigFloat
@test typeof(BigFloat(realmax(Float64))) == BigFloat
Expand All @@ -58,14 +58,14 @@ g = BigFloat("1234567890124.456789012345")
@test_approx_eq_eps f+int16(1) g tol
@test_approx_eq_eps f+int32(1) g tol
@test_approx_eq_eps f+int64(1) g tol
@test_approx_eq_eps f+int128(1) g tol
#@test_approx_eq_eps f+int128(1) g tol

@test_approx_eq_eps f+true g tol
@test_approx_eq_eps f+uint8(1) g tol
@test_approx_eq_eps f+uint16(1) g tol
@test_approx_eq_eps f+uint32(1) g tol
@test_approx_eq_eps f+uint64(1) g tol
@test_approx_eq_eps f+uint128(1) g tol
#@test_approx_eq_eps f+uint128(1) g tol

@test_approx_eq_eps f+BigInt(1) g tol

Expand Down
8 changes: 4 additions & 4 deletions test/bigint.jl
Original file line number Diff line number Diff line change
Expand Up @@ -43,29 +43,29 @@ end
@test typeof(BigInt(typemax(Int16))) == BigInt
@test typeof(BigInt(typemax(Int32))) == BigInt
@test typeof(BigInt(typemax(Int64))) == BigInt
@test typeof(BigInt(typemax(Int128))) == BigInt
#@test typeof(BigInt(typemax(Int128))) == BigInt

@test typeof(BigInt(true)) == BigInt
@test typeof(BigInt(typemax(Uint8))) == BigInt
@test typeof(BigInt(typemax(Uint16))) == BigInt
@test typeof(BigInt(typemax(Uint32))) == BigInt
@test typeof(BigInt(typemax(Uint64))) == BigInt
@test typeof(BigInt(typemax(Uint128))) == BigInt
#@test typeof(BigInt(typemax(Uint128))) == BigInt

@test typeof(BigInt(BigInt(1))) == BigInt

@test a+int8(1) == b
@test a+int16(1) == b
@test a+int32(1) == b
@test a+int64(1) == b
@test a+int128(1) == b
#@test a+int128(1) == b

@test a+true == b
@test a+uint8(1) == b
@test a+uint16(1) == b
@test a+uint32(1) == b
@test a+uint64(1) == b
@test a+uint128(1) == b
#@test a+uint128(1) == b

@test a+BigInt(1) == b

Expand Down

0 comments on commit 9a4a824

Please sign in to comment.