From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27552 invoked by alias); 14 Jan 2011 15:37:07 -0000 Received: (qmail 27461 invoked by uid 22791); 14 Jan 2011 15:37:05 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 14 Jan 2011 15:37:00 +0000 From: "burnus at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/47293] libquadmath: strtoflt128 - NAN not correctly read and C99 hex floating point format missing X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: burnus at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Summary Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 14 Jan 2011 15:43:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2011-01/txt/msg01374.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47293 Tobias Burnus 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 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 #include /* For abort. */ #include /* 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; }