diff --git a/core/math/floats/floats-tests.factor b/core/math/floats/floats-tests.factor index ae72aba67f..d8d4e03b0f 100644 --- a/core/math/floats/floats-tests.factor +++ b/core/math/floats/floats-tests.factor @@ -93,3 +93,12 @@ unit-test [ 5.0 ] [ 3 5.0 max ] unit-test [ 3 ] [ 3 5.0 min ] unit-test + +{ 39 0x1.999999999998ap-4 } [ 4.0 .1 /mod ] unit-test +{ 38 0x1.9999999999984p-4 } [ 3.9 .1 /mod ] unit-test +{ 39 0x1.999999999998ap-4 } [ 4.0 -.1 /mod ] unit-test +{ 38 0x1.9999999999984p-4 } [ 3.9 -.1 /mod ] unit-test +{ 39 -0x1.999999999998ap-4 } [ -4.0 -.1 /mod ] unit-test +{ 38 -0x1.9999999999984p-4 } [ -3.9 -.1 /mod ] unit-test +{ 39 -0x1.999999999998ap-4 } [ -4.0 .1 /mod ] unit-test +{ 38 -0x1.9999999999984p-4 } [ -3.9 .1 /mod ] unit-test diff --git a/core/math/floats/floats.factor b/core/math/floats/floats.factor index 3fa9be4cad..58f40d2ffc 100644 --- a/core/math/floats/floats.factor +++ b/core/math/floats/floats.factor @@ -38,7 +38,7 @@ M: float /i float/f >integer ; inline M: real abs dup 0 < [ neg ] when ; inline -M: real /mod [ /i ] [ mod ] 2bi ; inline +M: real /mod dupd mod [ [ - ] [ /i ] bi ] keep ; inline M: float fp-special? double>bits -52 shift 0x7ff [ bitand ] keep = ; inline