Skip to content

Commit

Permalink
Merge pull request #10145 from rickhg12hs/complex-round-32-bit-workar…
Browse files Browse the repository at this point in the history
…ound

Update base/complex.jl for Complex round (Fix/Workaround #10027)
  • Loading branch information
staticfloat committed Feb 10, 2015
2 parents ef6a0f1 + 64908c8 commit 1575bc8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions base/complex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -692,13 +692,14 @@ function lexcmp(a::Complex, b::Complex)
end

#Rounding complex numbers
# Superfluous tuple splatting in return arguments is a work around for 32-bit systems (#10027)
#Requires two different RoundingModes for the real and imaginary components
function round{T<:FloatingPoint, MR, MI}(z::Complex{T}, ::RoundingMode{MR}, ::RoundingMode{MI})
Complex(round(real(z), RoundingMode{MR}()),
round(imag(z), RoundingMode{MI}()))
Complex((round(real(z), RoundingMode{MR}()),
round(imag(z), RoundingMode{MI}()))...)
end

round(z::Complex) = Complex(round(real(z)), round(imag(z)))
round(z::Complex) = Complex((round(real(z)), round(imag(z)))...)
@vectorize_1arg Complex round

function round(z::Complex, digits::Integer, base::Integer=10)
Expand Down

0 comments on commit 1575bc8

Please sign in to comment.