Greetings! OK this is fixed on branch 2.6.8pre. Please note the comment below -- I still don't see how to re-parse denormalized numbers accurately -- if you do, any comments would be most helpful.
Take care, ============================================================================= Hello, I claim 12.3456, 12.3456d0, 123.456d-1, 1234.56d-2, and 12345.6d-3 all designate the same IEEE 754 double precision float. GCL 2.6.7 ANSI (Linux) disagrees: (mapcar #'integer-decode-float '(12.3456 12.3456d0 123.456d-1 1234.56d-2 12345.6d-3)) (6949954944958149 6949954944958149 6949954944958150 6949954944958149 6949954944958150) I didn't check any other floating point inputs (neither S nor E nor L, nor any other specific combinations of digits). I tried to report this via http://savannah.gnu.org/bugs/?group=gcl but the "Bugs" javascript menu is rendered incorrectly in my browser (Mozilla 1.4.1) such that I can't click "Submit" on the menu. FWIW. regards Robert Dodier ============================================================================= Index: o/read.d =================================================================== RCS file: /cvsroot/gcl/gcl/o/read.d,v retrieving revision 1.14.4.1.2.2.2.4.6.1.6.1.4.4 diff -u -r1.14.4.1.2.2.2.4.6.1.6.1.4.4 read.d --- o/read.d 25 Aug 2006 16:32:53 -0000 1.14.4.1.2.2.2.4.6.1.6.1.4.4 +++ o/read.d 3 Jul 2007 15:29:55 -0000 @@ -694,6 +694,25 @@ (i) == 'b' || (i) == 'B') double pow(); + +static double +new_fraction(char *s,int end,int exp_pos) { + + char ch,ch1; + double fraction; + + ch=s[end]; + s[end]=0; + if (exp_pos>=0) {ch1=s[exp_pos];s[exp_pos]='E';} + sscanf(s,"%lf",&fraction); + s[end]=ch; + if (exp_pos>=0) s[exp_pos]=ch1; + + return fraction; + +} + + /* Parse_number(s, end, ep, radix) parses C string s up to (but not including) s[end] @@ -712,7 +731,7 @@ object integer_part; double fraction, fraction_unit, f; char exponent_marker; - int exponent; + int exponent,exp_pos=-1; int i, j, k; int d; vs_mark; @@ -858,6 +877,7 @@ if (radix!=10) FEerror("Parse_number radix error", 0); exponent_marker = s[i]; + exp_pos=i; i++; if (i >= end) goto NO_NUMBER; @@ -899,11 +919,11 @@ goto MAKE_FLOAT; case 's': case 'S': - x = make_shortfloat((shortfloat)fraction); + x = make_shortfloat((shortfloat)new_fraction(s,end,exp_pos));/*FIXME code above cannot re-read denormalized numbers accurately*/ break; case 'f': case 'F': case 'd': case 'D': case 'l': case 'L': - x = make_longfloat((longfloat)fraction); + x = make_longfloat((longfloat)new_fraction(s,end,exp_pos)); break; case 'b': case 'B': ============================================================================= -- Camm Maguire [EMAIL PROTECTED] ========================================================================== "The earth is but one country, and mankind its citizens." -- Baha'u'llah _______________________________________________ Gcl-devel mailing list Gcl-devel@gnu.org http://lists.gnu.org/mailman/listinfo/gcl-devel