|
From: Barton W. <wi...@un...> - 2025-12-05 18:21:59
|
For subnormal floats, the SBCL CL function scale-float is possibly buggy: SBCL 2.4.7: Define Maxima function that calls the CL function scale-float (%i1) :lisp(defun $scale_float (x m) (scale-float x m)) (%i1) x : 2.0^(-1024); (%o1) 5.562684646268004e-309 This is a SBCL bug, I think: surely scaling by zero should be an identity? (%i2) scale_float(x,0); (%o2) 2.7813423231340017e-308 (%i3) x : 2.0^(-1023); (%o3) 1.1125369292536007e-308 This is also wrong: (%i4) scale_float(x,0); (%o4) 3.337610787760802e-308 (%i5) x : 2.0^(-1022); (%o5) 2.2250738585072014e-308 Finally this is OK: (%i6) scale_float(x,0); (%o6) 2.2250738585072014e-308 With CCL 1.13 (%i1) :lisp(defun $scale_float (x m) (scale-float x m)) This is a recently reported CCL bug (%i1) x : 2.0^(-1024); Maxima encountered a Lisp error: FLOATING-POINT-OVERFLOW detected performing * on (1.3407807929942597E+154 1.3407807929942597E+154) A silly workaround for this bug: (%i2) x : 2.0^(-1023)/2; (%o2) 5.562684646268003E-309 OK: (%i3) scale_float(x,0); (%o3) 5.562684646268003E-309 OK: (%i4) x : 2.0^(-1023); (%o4) 1.1125369292536007E-308 OK: (%i5) scale_float(x,0); (%o5) 1.1125369292536007E-308 |