Skip to content

Commit

Permalink
don't promote Integer^BigInt to BigInt
Browse files Browse the repository at this point in the history
Fixes the following inconsistency:

    julia> [0x2^T(9) for T in (Int16,Int32,Int64,BigInt)]
    4-element Array{Any,1}:
     0x00
     0x00
     0x00
      512
  • Loading branch information
nolta committed Aug 1, 2015
1 parent 04b0cca commit d9bcdeb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 0 additions & 1 deletion base/gmp.jl
Expand Up @@ -414,7 +414,6 @@ end
^(x::BigInt , y::BigInt ) = bigint_pow(x, y)
^(x::BigInt , y::Bool ) = y ? x : one(x)
^(x::BigInt , y::Integer) = bigint_pow(x, y)
^(x::Integer, y::BigInt ) = bigint_pow(BigInt(x), y)

function powermod(x::BigInt, p::BigInt, m::BigInt)
p < 0 && throw(DomainError())
Expand Down
2 changes: 2 additions & 0 deletions test/numbers.jl
Expand Up @@ -2509,3 +2509,5 @@ for (d,B) in ((4//2+1im,Rational{BigInt}),(3.0+1im,BigFloat),(2+1im,BigInt))
@test typeof(big([d])) == Vector{Complex{B}}
@test big([d]) == [d]
end

@test 0x2^9 === 0x2^big(9) === 0x0

0 comments on commit d9bcdeb

Please sign in to comment.