From patchwork Fri Apr 29 16:07:23 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Blomqvist X-Patchwork-Id: 93453 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 57991B6FCC for ; Sat, 30 Apr 2011 02:07:47 +1000 (EST) Received: (qmail 26183 invoked by alias); 29 Apr 2011 16:07:40 -0000 Received: (qmail 26158 invoked by uid 22791); 29 Apr 2011 16:07:38 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-pv0-f175.google.com (HELO mail-pv0-f175.google.com) (74.125.83.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 29 Apr 2011 16:07:24 +0000 Received: by pvc30 with SMTP id 30so2681423pvc.20 for ; Fri, 29 Apr 2011 09:07:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.32.72 with SMTP id g8mr5062602pbi.406.1304093243718; Fri, 29 Apr 2011 09:07:23 -0700 (PDT) Received: by 10.68.62.132 with HTTP; Fri, 29 Apr 2011 09:07:23 -0700 (PDT) Date: Fri, 29 Apr 2011 19:07:23 +0300 Message-ID: Subject: [Patch, libfortran] PR 48488 Fix comments From: Janne Blomqvist To: Fortran List , GCC Patches Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Hi all, now that we fixed real output, I update the comments per the patch below and committed. Index: io/write.c =================================================================== --- io/write.c (revision 173168) +++ io/write.c (working copy) @@ -1456,10 +1456,18 @@ set_fnode_default (st_parameter_dt *dtp, break; } } -/* Output a real number with default format. - This is 1PG14.7E2 for REAL(4), 1PG23.15E3 for REAL(8), - 1PG28.19E4 for REAL(10) and 1PG43.34E4 for REAL(16). */ -// FX -- FIXME: should we change the default format for __float128-real(16)? + +/* Output a real number with default format. To guarantee that a + binary -> decimal -> binary roundtrip conversion recovers the + original value, IEEE 754-2008 requires 9, 17, 21 and 36 significant + digits for REAL kinds 4, 8, 10, and 16, respectively. Thus, we use + 1PG16.9E2 for REAL(4), 1PG25.17E3 for REAL(8), 1PG30.21E4 for + REAL(10) and 1PG45.36E4 for REAL(16). The exception is that the + Fortran standard requires outputting an extra digit when the scale + factor is 1 and when the magnitude of the value is such that E + editing is used. However, gfortran compensates for this, and thus + for list formatted the same number of significant digits is + generated both when using F and E editing. */ void write_real (st_parameter_dt *dtp, const char *source, int length) @@ -1472,6 +1480,8 @@ write_real (st_parameter_dt *dtp, const dtp->u.p.scale_factor = org_scale; } +/* Similar to list formatted REAL output, for kPG0 where k > 0 we + compensate for the extra digit. */ void write_real_g0 (st_parameter_dt *dtp, const char *source, int length, int d)