2 ms·
You can tell Common Lisp to read double-floats by default. CL-USER 113 > (+ 0.1 0.2) 0.3 CL-USER 114 > *read-default-float-format* SINGLE-FLOA
by lispm 10y ago
You can tell Common Lisp to read double-floats by default.
CL-USER 113 > (+ 0.1 0.2)
0.3
CL-USER 114 > *read-default-float-format*
SINGLE-FLOAT
CL-USER 115 > (setf *read-default-float-format* 'double-float)
DOUBLE-FLOAT
CL-USER 116 > (+ 0.1 0.2)
0.30000000000000005
Thus if one wants to make sure which float format Lisp should be reading,
a) specify the default format, as above
b) or use s, f, d, and l to specify the format (short float, single float, double-float, long-float). Example 1.0s0, 1.0f0, 1.0d0, 1.0l0