Merge branch 'master' of git://github.com/slavapestov/factor

db4
John Benediktsson 2010-11-13 14:29:31 -08:00
commit 9b6f05a53b
2 changed files with 17 additions and 6 deletions

View File

@ -62,6 +62,21 @@ unit-test
[ 5 ] [ 10.5 1.9 /i ] unit-test
[ t ] [ 0 0 /f fp-nan? ] unit-test
[ t ] [ 0.0 0.0 /f fp-nan? ] unit-test
[ t ] [ 0.0 0.0 / fp-nan? ] unit-test
[ t ] [ 0 0 [ >bignum ] bi@ /f fp-nan? ] unit-test
[ 1/0. ] [ 1 0 /f ] unit-test
[ 1/0. ] [ 1.0 0.0 /f ] unit-test
[ 1/0. ] [ 1.0 0.0 / ] unit-test
[ 1/0. ] [ 1 0 [ >bignum ] bi@ /f ] unit-test
[ -1/0. ] [ -1 0 /f ] unit-test
[ -1/0. ] [ -1.0 0.0 /f ] unit-test
[ -1/0. ] [ -1.0 0.0 / ] unit-test
[ -1/0. ] [ -1 0 [ >bignum ] bi@ /f ] unit-test
[ t ] [ 0/0. 0/0. unordered? ] unit-test
[ t ] [ 1.0 0/0. unordered? ] unit-test
[ t ] [ 0/0. 1.0 unordered? ] unit-test

View File

@ -142,12 +142,8 @@ M: bignum (log2) bignum-log2 ; inline
! Main word
: /f-abs ( m n -- f )
over zero? [
2drop 0.0
] [
[
drop 1/0.
] [
over zero? [ nip zero? 0/0. 0.0 ? ] [
[ drop 1/0. ] [
pre-scale
/f-loop
[ over odd? [ zero? [ 1 + ] unless ] [ drop ] if ] dip