You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
math.abs(-0.0) returns 0.0 as it should, but (-0.0).abs returns -0.0. The reason is that math.abs directly calls java.lang.Math.abs but (-0.0).abs is implemented in Numeric.scala by checking if the value is < 0, which fails for -0.0.
One way to fix this is to use compare instead of lt:
math.abs(-0.0)
returns 0.0 as it should, but(-0.0).abs
returns -0.0. The reason is thatmath.abs
directly callsjava.lang.Math.abs
but(-0.0).abs
is implemented inNumeric.scala
by checking if the value is < 0, which fails for -0.0.One way to fix this is to use
compare
instead oflt
:There may well be other bugs involving -0.0.
The text was updated successfully, but these errors were encountered: