From: Raymond T. <rt...@us...> - 2003-08-02 14:07:25
|
Update of /cvsroot/maxima/maxima/src In directory sc8-pr-cvs1:/tmp/cvs-serv22611/src Modified Files: float.lisp Log Message: Bug 781753: bfloat->float fails for very large and very small Use scale-float to scale the mantissa. Index: float.lisp =================================================================== RCS file: /cvsroot/maxima/maxima/src/float.lisp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- float.lisp 18 Mar 2003 01:56:05 -0000 1.7 +++ float.lisp 2 Aug 2003 14:07:22 -0000 1.8 @@ -297,12 +297,14 @@ ;;and then convert it to a floating point fraction. (SETQ MANTISSA (QUOTIENT (FPROUND MANTISSA) #.(EXPT 2.0 MACHINE-MANTISSA-PRECISION))) - ;;Multiply the mantissa by the exponent portion. I'm not sure - ;;why the exponent computation is so complicated. - (SETQ PRECISION - (ERRSET (TIMES MANTISSA (EXPT 2.0 (f+ EXPONENT (MINUS PRECISION) *M - #.MACHINE-MANTISSA-PRECISION))) - NIL)) + ;; Multiply the mantissa by the exponent portion. I'm not sure + ;; why the exponent computation is so complicated. Using + ;; scale-float will prevent possible overflow unless the result + ;; really would. + (setq precision + (errset (scale-float mantissa (f+ exponent (minus precision) *m + #.machine-mantissa-precision)) + nil)) (IF PRECISION (CAR PRECISION) (MERROR "Floating point overflow in converting ~:M to flonum" L)))) |