From da6fc0f158fa9c76e5df675f57b57aa8c7a4b1b7 Mon Sep 17 00:00:00 2001 From: Shiro Kawai Date: Wed, 2 Feb 2011 14:35:21 +0000 Subject: correct error estimation of floating point number reader diff --git a/src/number.c b/src/number.c index 9a7d8f8..d121edd 100644 --- a/src/number.c +++ b/src/number.c @@ -3543,6 +3543,7 @@ static double algorithmR(ScmObj f, int e, double z) case -1: /* d2 < y */ if (Scm_NumCmp(m, SCM_2_52) == 0 && sign_d < 0 + && k > -1074 && Scm_NumCmp(Scm_Ash(d2, 1), y) > 0) { goto prevfloat; } else { diff --git a/test/number.scm b/test/number.scm index d397630..eb6d7eb 100644 --- a/test/number.scm +++ b/test/number.scm @@ -270,6 +270,12 @@ (test* "flonum reader (minimum denormalized number -5.0e-324)" #t (let1 x (- (expt 2.0 -1074)) (= x (string->number (number->string x))))) + +;; This hanged in 0.9.1. See Jens Thiele's message in gauche-devel +;; in Feb. 2011. +(test* "flonum reader (minimum normalized number)" #t + (= (expt 2.0 (- 52 1074)) + (string->number "2.2250738585072012e-308"))) (test* "padding" '(10.0 #t) (flonum-test '1#)) -- 1.7.3.4