Skip to content

Commit

Permalink
bugfix: fld1 order of ops
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreySarnoff committed Sep 29, 2022
1 parent 6e1e6fa commit 134a91b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ julia> x == (fld1(x, y) - 1) * y + mod1(x, y)
true
```
"""
fld1(x::T, y::T) where {T<:Real} = (m = mod1(x, y); fld(x + y - m, y))
fld1(x::T, y::T) where {T<:Real} = (m = mod1(x, y); fld((x - m) + y, y))
function fld1(x::T, y::T) where T<:Integer
d = div(x, y)
return d + (!signbit(x y) & (d * y != x))
Expand Down

0 comments on commit 134a91b

Please sign in to comment.