]> gitweb.factorcode.org Git - factor.git/commitdiff
0.0 neg ought to be -0.0
authorJoe Groff <arcata@gmail.com>
Thu, 21 May 2009 23:49:22 +0000 (18:49 -0500)
committerJoe Groff <arcata@gmail.com>
Thu, 21 May 2009 23:49:22 +0000 (18:49 -0500)
core/math/math-tests.factor
core/math/math.factor

index b7cc51e6693586821d7fab5ac0be3bc6756fda68..831430cf24cacff24590acfcd0e999f7bc8b6bee 100644 (file)
@@ -26,6 +26,9 @@ IN: math.tests
 [ f ] [ 0 <fp-nan> fp-nan? ] unit-test
 [ t ] [ 0 <fp-nan> 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
index da9bc4d1b5346fa61f266b12d5041aabc0e3318e..28efbaa26e4a099b8c7502b2f6cef23f13573a54 100755 (executable)
@@ -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