Skip to content

Commit 9d4df8f

Browse files
committed
Fix mixed sign case
As it turns out, our `mod` is not the same as C's `fmod`; that one is `rem`.
1 parent 0234844 commit 9d4df8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

base/math.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ function rem(x::Float64, p::Float64, ::RoundingMode{:Nearest})
893893
return NaN
894894
end
895895
if hp <= 0x7fdfffff
896-
x = mod(x, p + p) # now x < 2p
896+
x = rem(x, p + p) # now x < 2p
897897
end
898898
((hx - hp) | (lx - lp)) == 0 && return 0.0
899899
x = abs(x)
@@ -932,7 +932,7 @@ function rem(x::Float32, p::Float32, ::RoundingMode{:Nearest})
932932
return NaN32
933933
end
934934
if hp <= 0x7effffff
935-
x = mod(x, p + p) # now x < 2p
935+
x = rem(x, p + p) # now x < 2p
936936
end
937937
hx - hp == 0 && return 0.0f0
938938
x = abs(x)

0 commit comments

Comments
 (0)