3 ms·
The Common Lisp version is slightly misleading because computations are made by default with single-float types, whereas there is also short-float, double-float
by junke 11y ago
The Common Lisp version is slightly misleading because computations are made by default with single-float types, whereas there is also short-float, double-float and long-float.
- nabla9 11y agodefault for READ-DEFAULT-FLOAT-FORMAT is implementation dependent and can be changed by user. In CL type float has subtypes single-float, double-float, short-float, and long-float. "Any two of them must be either disjoint types or the same type; if the same type, then any other types between them in the above ordering must also be the same type. For example, if the type single-float and the type long-float are the same type, then the type double-float must be the same type also." If there is only one float representation it has to be `(typep x 'single-float)` but if the internal representation is different (double-float for example) it can be all of the types. At least this is how I understand the spec. http://clhs.lisp.se/Body/v_rd_def.htm#STread-default-float-formatST http://clhs.lisp.se/Body/v_rd_def.htm#STread-default-float-f... http://clhs.lisp.se/Body/t_float.htm#float http://clhs.lisp.se/Body/t_float.htm#float http://clhs.lisp.se/Body/t_short_.htm http://clhs.lisp.se/Body/t_short_.htm
- junke 11y agoIndeed. Note also that there are recommended minimum precisions and exponent sizes, which are followed in practice by CL implementations. That means that if double and long are the same type, the precision and size is at least the one recommended for long-float.