diff --git a/core/math/math-tests.factor b/core/math/math-tests.factor index b7cc51e669..831430cf24 100644 --- a/core/math/math-tests.factor +++ b/core/math/math-tests.factor @@ -26,6 +26,9 @@ IN: math.tests [ f ] [ 0 fp-nan? ] unit-test [ t ] [ 0 fp-infinity? ] unit-test +[ t ] [ 0.0 neg -0.0 fp-bitwise= ] unit-test +[ t ] [ -0.0 neg 0.0 fp-bitwise= ] unit-test + [ 0.0 ] [ -0.0 next-float ] unit-test [ t ] [ 1.0 dup next-float < ] unit-test [ t ] [ -1.0 dup next-float < ] unit-test diff --git a/core/math/math.factor b/core/math/math.factor index da9bc4d1b5..28efbaa26e 100755 --- a/core/math/math.factor +++ b/core/math/math.factor @@ -60,7 +60,7 @@ PRIVATE> : 1- ( x -- y ) 1 - ; inline : 2/ ( x -- y ) -1 shift ; inline : sq ( x -- y ) dup * ; inline -: neg ( x -- -x ) 0 swap - ; inline +: neg ( x -- -x ) -1 * ; inline : recip ( x -- y ) 1 swap / ; inline : sgn ( x -- n ) dup 0 < [ drop -1 ] [ 0 > 1 0 ? ] if ; inline : ?1+ ( x -- y ) [ 1 + ] [ 0 ] if* ; inline