From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22518 invoked by alias); 21 Apr 2006 17:22:21 -0000 Received: (qmail 22478 invoked by uid 48); 21 Apr 2006 17:22:17 -0000 Date: Fri, 21 Apr 2006 17:22:00 -0000 Message-ID: <20060421172217.22477.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug libfortran/24685] real(16) formatted input is broken for huge values In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "jakub at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-04/txt/msg01776.txt.bz2 List-Id: ------- Comment #18 from jakub at gcc dot gnu dot org 2006-04-21 17:22 ------- While this should now be fixed on s390{,x} (and I believe also sparc*) with -mlong-double-128, it is still broken on powerpc{,64}. What happens there is that gfortran returns a non-canonical number for huge (0.0_16) (by non-canonical I mean that the difference between upper and lower double's exponent is more than 53, in this case 106 or so, particularly upper double is 8.9884656743115795e+307 and lower double -1.1079139325602226e+276). libc only cares about 106 fraction bits, so when printed into buffer, it is already printed the same as 8.9884656743115795e+307 + 0.0 alone (i.e. 8.9884656743115795386465259539451237e+307) and when read back it is read as 8.9884656743115795e+307 + 0.0. I wonder if gfortran should either always or at least for the couple of special numbers for the real(16) and complex(16) kinds choose numbers that are canonical in this sense (and can thus be written and read back the same). E.g. when C parses IBM extended long double constants, they seem to be always canonical (supposedly because it always rounds to 106 fraction bits). -- jakub at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |amodra at gcc dot gnu dot | |org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24685