diff --git a/extra/math/floating-point/floating-point-tests.factor b/extra/math/floating-point/floating-point-tests.factor index 2a60d30d02..7f3a87f9a5 100644 --- a/extra/math/floating-point/floating-point-tests.factor +++ b/extra/math/floating-point/floating-point-tests.factor @@ -1,4 +1,7 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: tools.test math.floating-point ; +USING: tools.test math.floating-point math.constants kernel ; IN: math.floating-point.tests + +[ t ] [ pi >double< >double pi = ] unit-test +[ t ] [ -1.0 >double< >double -1.0 = ] unit-test diff --git a/extra/math/floating-point/floating-point.factor b/extra/math/floating-point/floating-point.factor index 3792d6ba9b..0d224bfc9d 100644 --- a/extra/math/floating-point/floating-point.factor +++ b/extra/math/floating-point/floating-point.factor @@ -1,20 +1,20 @@ ! Copyright (C) 2008 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math sequences prettyprint math.parser io -math.functions ; +math.functions math.bitwise ; IN: math.floating-point : (double-sign) ( bits -- n ) -63 shift ; inline : double-sign ( double -- n ) double>bits (double-sign) ; : (double-exponent-bits) ( bits -- n ) - -52 shift 11 2^ 1- bitand ; inline + -52 shift 11 on-bits mask ; inline : double-exponent-bits ( double -- n ) double>bits (double-exponent-bits) ; : (double-mantissa-bits) ( double -- n ) - 52 2^ 1- bitand ; + 52 on-bits mask ; : double-mantissa-bits ( double -- n ) double>bits (double-mantissa-bits) ; @@ -37,4 +37,3 @@ IN: math.floating-point (double-mantissa-bits) >bin 52 CHAR: 0 pad-left 11 [ bl ] times print ] tri ; -