The test result that fails differs from the "correct" value in fptest.l by one least significant bit:

: (d2s 4607137420321232833 "%18.16f")
-> "0.9950041652780258"
: (d2s 4607137420321232832 "%18.16f")
-> "0.9950041652780257"

This is actually a lot better than I expected. I expected about half of the trigonometric and transcendental functions to fail this way on different processors, operating systems, and compilers. We should give a tip of the hat to the nameless, faceless software engineers who write these underlying trig functions that are so fast and so accurate.

The "bug" would be in fptest.l. Floating point tests should not be made against exact values, but against a value with an specified delta of accuracy. Perhaps a future version of picolisp-fp will have better unit tests like that.


Greg Lee

-----Original Message-----
From: Mike Pechkin
Sent: Jan 25, 2016 5:22 AM
To: picolisp@software-lab.de
Subject: fp + SunOS


fp now works on solaris in pil64.
only one test fails, on linux it pass:

# pil +
: (load "@lib/fp.l")
-> dmodf
: (load "fptest.l")
((dcos 4591870180066957722))
[fptest.l:201] 4607137420321232833 -- 'test' failed
? (dcos 4591870180066957722)
-> 4607137420321232832

p.s. i've run separate version too, it fails on the same test

-- UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to