Skip to content

Commit 00ee103

Browse files
bachdaviNHDaly
andauthored
Update src/FixedPointDecimals.jl
Co-authored-by: Nathan Daly <nathan.daly@relational.ai>
1 parent 250c089 commit 00ee103

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/FixedPointDecimals.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ function _round_to_even(quotient::T, remainder::T, divisor::T, ::RoundingMode{M}
141141
# -9. `:NearestTiesUp` will always ties towards positive
142142
# infinity. `:Nearest` will tie towards the nearest even
143143
# integer.
144-
if M == :NearestTiesAway && quotient < zero(quotient)
145-
quotient
146-
elseif M == :Nearest && iseven(quotient)
147-
quotient
144+
if M == :NearestTiesAway
145+
ifelse(quotient < zero(quotient), quotient, quotient + one(quotient))
146+
elseif M == :Nearest
147+
ifelse(iseven(quotient), quotient, quotient + one(quotient))
148148
else
149149
quotient + one(quotient)
150150
end

0 commit comments

Comments
 (0)