Thread View: gmane.comp.gcc.bugs
4 messages
4 total messages
Started by "burnus at gcc d
Fri, 14 Jan 2011 15:05
[Bug fortran/47293] New: libquadmath: strtoflt128 - C99 hex floating point format missing
Author: "burnus at gcc d
Date: Fri, 14 Jan 2011 15:05
Date: Fri, 14 Jan 2011 15:05
31 lines
1042 bytes
1042 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?idG293 Summary: libquadmath: strtoflt128 - C99 hex floating point format missing Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned@gcc.gnu.org ReportedBy: burnus@gcc.gnu.org (At some point, I - or someone else - should really create a libquadmath component in Bugzilla.) Follow up to http://gcc.gnu.org/ml/gcc-patches/2011-01/msg00369.html strtoflt128 currently does not support the C99 hex floating point format However, there is: "gethex" in gdtoa/strtodg.c (called from strtoflt128) thus it might already be implemented. From POSIX 2003 for strtod: "The expected form of the subject sequence is an optional plus or minus sign, then one of the following: [...] * A 0x or 0X, then a non-empty sequence of hexadecimal digits optionally containing a radix character, then an optional binary exponent part"
[Bug fortran/47293] libquadmath: strtoflt128 - NAN not correctly read and C99 hex floating point format missing
Author: "burnus at gcc d
Date: Fri, 14 Jan 2011 15:36
Date: Fri, 14 Jan 2011 15:36
54 lines
1791 bytes
1791 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?idG293 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Summary|libquadmath: strtoflt128 - |libquadmath: strtoflt128 - |C99 hex floating point |NAN not correctly read and |format missing |C99 hex floating point | |format missing --- Comment #1 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-01-14 15:36:52 UTC --- Additional problem: The NAN string to float128 conversion does not seem to work. [The way NaN is printed by the float128->string conversion function is also a bit odd, but it seems to work (with libgfortran).] The program below prints: +N.aN000000000000000000e+02 +7.82797652694030368547e-4942 The a similar Fortran program prints (value printed as hex): 0 0 0 FFFF8000 -- for NaN (gfortran and ifort) 0 C0000000 FFFF 0 -- for the "NaN" string (= 0.78280E-4941) If one debugs gdtoa/strtodg.c, one sees that STRTOG_NaN is properly detected. Thus, either the bits are wrong in strtodg -- or it is wrongly handled in strtoflt128. Example (strtoflt128 was called "quadmath_strtopQ" before renaming.) #include <quadmath.h> #include <stdlib.h> /* For abort. */ #include <stdio.h> /* For printf. */ int main () { __float128 r; char str[200]; r = nanq(NULL); quadmath_dtoaq (str, sizeof (str), 20, r); printf("%s\n", str); r = 3.0q; /* quadmath_strtopQ ("NaN", NULL, &r); */ r = strtoflt128 ("NaN", NULL); quadmath_dtoaq (str, sizeof (str), 20, r); printf("%s\n", str); if (!isnanq(r)) abort(); return 0; }
[Bug fortran/47293] libquadmath: strtoflt128 - NAN not correctly read and C99 hex floating point format missing
Author: "jvdelisle at gc
Date: Sat, 22 Jan 2011 14:26
Date: Sat, 22 Jan 2011 14:26
13 lines
602 bytes
602 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?idG293 Jerry DeLisle <jvdelisle at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jvdelisle at gcc dot | |gnu.org AssignedTo|unassigned at gcc dot |jvdelisle at gcc dot |gnu.org |gnu.org --- Comment #2 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-22 14:25:52 UTC --- Taking this one
[Bug fortran/47293] libquadmath: strtoflt128 - NAN not correctly read and C99 hex floating point format missing
Author: "jvdelisle at gc
Date: Wed, 26 Jan 2011 05:45
Date: Wed, 26 Jan 2011 05:45
43 lines
981 bytes
981 bytes
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47293 --- Comment #3 from Jerry DeLisle <jvdelisle at gcc dot gnu.org> 2011-01-26 05:45:35 UTC --- I think this fixes it. Why it was whacked, who knows. Index: gd_qnan.h =================================================================== --- gd_qnan.h (revision 169141) +++ gd_qnan.h (working copy) @@ -2,9 +2,9 @@ #define d_QNAN0 0x0 #define d_QNAN1 0xfff80000 #define ld_QNAN0 0x0 -#define ld_QNAN1 0xc0000000 -#define ld_QNAN2 0xffff -#define ld_QNAN3 0x0 +#define ld_QNAN1 0x0 +#define ld_QNAN2 0x0 +#define ld_QNAN3 0xffff8000 #define ldus_QNAN0 0x0 #define ldus_QNAN1 0x0 #define ldus_QNAN2 0x0 Test program I used. Try this without the patch and it is very obvious what is wrong. character(len=200) :: str real(16) :: r, x, y, z integer(16) :: k x = 0.0 y = 0.0 r = 1.0 str = 'NAN' ; read(str,*) r print *, r z = x/y print *, z k = transfer(z,k) print "(b128)", k print * k = transfer(r,k) print "(b128)", k end
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads