From: SourceForge.net <noreply@so...>  20081126 15:16:57

Bugs item #2180110, was opened at 20081019 12:11 Message generated for change (Comment added) made by rtoy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2180110&group_id=4933 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Dieter Kaiser (crategus) Assigned to: Nobody/Anonymous (nobody) Summary: GCL do not signal an overflow converting bigfloat to float Initial Comment: With GCL we do not get overflow errors when converting bigfloat numbers into float numbers which are obviously too big to fit in a float number: This is a correct example: (%i11) float(gamma(150b0)); (%o11) 3.8089226376305632E+260 The following bigfloat numbers are too big. The result is unpredicable and wrong: (%i12) float(gamma(250b0)); (%o12) 4.0014303970800103E127 (%i13) float(gamma(2500b0)); (%o13) 5.0208574388889818E+9 I have observed this for GCL 2.6.8. CLISP 2.44 gives an overflow error. The problem is the Lisp function scalefloat which is called by fp2flo in the file float.lisp. Dieter Kaiser  Comment By: Raymond Toy (rtoy) Date: 20081126 10:16 Message: Here is a replacement. It explicitly checks for overflow and signals it. An overflow happens if the exponent is larger than 1024, the largest doublefloat exponent. (defmfun fp2flo (l) (let ((precision (caddar l)) (mantissa (cadr l)) (exponent (caddr l)) (fpprec machinemantissaprecision) (*m 0)) (setq mantissa (quotient (fpround mantissa) (expt 2.0 machinemantissaprecision))) (let ((e (+ exponent ( precision) *m machinemantissaprecision))) (if (>= (abs e) 1025) (merror "Floating point overflow in converting ~:M to flonum" l) (scalefloat mantissa e)))))  You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=104933&aid=2180110&group_id=4933 