why the (sub) behavior like this?

Started by dexter, July 19, 2015, 08:11:05 AM

Previous topic - Next topic

dexter


(sub 1.9 0.2) will work as I thought

but (sub 20000.9 20000.2) will not return 0.7 insead of
0.700000000000728



why not just return 0.7 ??



my newlisp is 10.6.0

rrq

#1
Maybe it has something to do with https://en.wikipedia.org/wiki/Single-precision_floating-point_format">//https://en.wikipedia.org/wiki/Single-precision_floating-point_format

Try
(format "%.30f" 20000.9)

dexter

#2
thanks



in the end ,I (mul) the number to be an integer,than I can deal the number with (-)