Double precision Floor bug?
I noticed this at work in LispWorks 5.1, but I get the same result in
LispWorks 6.1 when I just tried it at home:
(let ((x 0.59d0)
(d 0.01d0))
(multiple-value-bind (div rem) (floor x d)
(format t "floor(~A ~A) => ~A ~A~%" x d div rem)
(multiple-value-bind (div2 rem2) (floor rem d)
(format t "floor(~A ~A) => ~A ~A~%" rem d div2 rem2))))
floor(0.59D0 0.01D0) => 58 0.010000000000000009D0
floor(0.010000000000000009D0 0.01D0) => 1 8.673617379884036D-18
I would have expected the first result to be 59 0.000000000000000009D0
At first I thought it might some kind of floating-point
rounding/precision issue, but I don't think that would explain the
second value returned by floor being greater than the second argument
given to floor.
Regards
Guy Footring
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
lisp-hug@lispworks.com
http://www.lispworks.com/support/lisp-hug.html