Skip to content

Commit

Permalink
Fix various corner cases with operators on Numbers
Browse files Browse the repository at this point in the history
These only affected particular type combinations, with either
type instabilities which affected inference of return type
or plain failures. Tests are included in the next commit.
  • Loading branch information
nalimilan committed Jul 2, 2016
1 parent f3eabc3 commit 732828c
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ function ^{T<:AbstractFloat}(z::Complex{T}, p::Complex{T})
if p==2 #square
zr, zi = reim(z)
x = (zr-zi)*(zr+zi)
y = 2zr*zi
y = T(2)*zr*zi
if isnan(x)
if isinf(y)
x = copysign(zero(T),zr)
Expand Down
1 change: 1 addition & 0 deletions base/gmp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ end
^(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)
^(x::Bool , y::BigInt ) = Base.power_by_squaring(x, y)

function powermod(x::BigInt, p::BigInt, m::BigInt)
r = BigInt()
Expand Down
2 changes: 1 addition & 1 deletion base/intfuncs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ ndigits0z(x::Integer) = ndigits0z(unsigned(abs(x)))

const ndigits_max_mul = Core.sizeof(Int) == 4 ? 69000000 : 290000000000000000

function ndigits0znb(n::Int, b::Int)
function ndigits0znb(n::Signed, b::Int)
d = 0
while n != 0
n = cld(n,b)
Expand Down

0 comments on commit 732828c

Please sign in to comment.