[Maxima] a curiosity: FLOAT returns double for single float
robert.dodier at gmail.com
Wed Jun 20 10:37:18 CDT 2012
Hi, why does this happen?
$ sh maxima-local -l clisp
Maxima branch_5_27_base_135_gdf1376c_dirty http://maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) :lisp (defparameter foo 1f0)
(%i1) :lisp (defparameter bar (float foo))
(%i1) :lisp (type-of foo)
(%i1) :lisp (type-of bar)
(%i1) :lisp (eq foo bar)
I've tried this with Clisp, SBCL, and ABCL. They all give the same
results. Incidentally without Maxima (just Lisp) the return value of
(FLOAT 1f0) is single float.
CLHS for FLOAT says that it returns its argument if the argument is a
float and there is no prototype given. So I'm surprised to see that a
double is returned for a single float argument.
There is *READ-DEFAULT-FLOAT-FORMAT* which is DOUBLE-FLOAT in Maxima,
but I wouldn't expect that to affect the function FLOAT.
More information about the Maxima