3 ms·
There's an easier way to specify long floats in Common Lisp: use the exponent marker "L" e.g. 9999999999999999.0L0. No need to bind or set reader variables. Th
by chaitanya 8y ago
There's an easier way to specify long floats in Common Lisp: use the exponent marker "L" e.g. 9999999999999999.0L0. No need to bind or set reader variables.
That said, even in Common Lisp I think its only CLISP (among the free implementations) that gives the correct answer for long floats.
CLISP:
[1]> (- 9999999999999999.0L0 9999999999999998.0L0)
1.0L0
SBCL, CMUCL and Clozure CL:
* (- 9999999999999999.0L0 9999999999999998.0L0)
2.0d0
The standard only mandates a minimum precision of 50 bits for both double and long floats, so there's no guarantee that using long floats will give the correct answer, as we can see.
http://www.lispworks.com/documentation/HyperSpec/Body/t_short_.htm http://www.lispworks.com/documentation/HyperSpec/Body/t_shor...