]> gitweb.factorcode.org Git - factor.git/commitdiff
math.functions: ~ now raises an invalid operation FP trap if one of the inputs is NaN
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 30 Sep 2009 04:41:08 +0000 (23:41 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Wed, 30 Sep 2009 04:41:08 +0000 (23:41 -0500)
basis/math/floats/env/env-tests.factor
basis/math/functions/functions-tests.factor
basis/math/functions/functions.factor

index 7f5a20efd00efb6fc30bf93cd37c5e90275968ea..61552e8e826e56730bcce6bb30368e9cae4df956 100644 (file)
@@ -29,6 +29,7 @@ set-default-fp-env
 [ t ] +fp-overflow+ [ 1.0e250 1.0e100 ] [ * ] test-fp-exception-compiled unit-test
 [ t ] +fp-underflow+ [ 1.0e-250 1.0e-100 ] [ * ] test-fp-exception-compiled unit-test
 [ t ] +fp-overflow+ [ 2.0 100,000.0 ] [ fpow ] test-fp-exception-compiled unit-test
+[ t ] +fp-invalid-operation+ [ 2.0 0/0. 1.0e-9 ] [ ~ ] test-fp-exception-compiled unit-test
 
 ! No underflow on Linux with this test, just inexact. Reported as an Ubuntu bug:
 ! https://bugs.launchpad.net/ubuntu/+source/glibc/+bug/429113
index 4502e993a3575faa8d61e3e6eac6a5cddf4945c3..1914bae008308c5ac2d158d68333a28deadf06c0 100644 (file)
@@ -44,8 +44,14 @@ IN: math.functions.tests
 [ 4.0 ] [ 10000.0 log10 ] unit-test
 
 [ t ] [ 1 exp e 1.e-10 ~ ] unit-test
+[ f ] [ 1 exp 0/0. 1.e-10 ~ ] unit-test
+[ f ] [ 0/0. 1 exp 1.e-10 ~ ] unit-test
 [ t ] [ 1.0 exp e 1.e-10 ~ ] unit-test
 [ t ] [ -1 exp e * 1.0 1.e-10 ~ ] unit-test
+[ f ] [ 1/0. 1/0. 1.e-10 ~ ] unit-test
+[ f ] [ 1/0. -1/0. 1.e-10 ~ ] unit-test
+[ f ] [ 1/0. 0/0. 1.e-10 ~ ] unit-test
+[ f ] [ 0/0. -1/0. 1.e-10 ~ ] unit-test
 
 [ 1.0 ] [ 0 cosh ] unit-test
 [ 1.0 ] [ 0.0 cosh ] unit-test
index a31b6ee7cc9457911c1ddb89c9825dec70a762a7..a9ad00341149a9f62de22e6f63a420b90e454786 100644 (file)
@@ -141,7 +141,6 @@ M: real absq sq ; inline
 
 : ~ ( x y epsilon -- ? )
     {
-        { [ 2over [ fp-nan? ] either? ] [ 3drop f ] }
         { [ dup zero? ] [ drop number= ] }
         { [ dup 0 < ] [ neg ~rel ] }
         [ ~abs ]