From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 6C1443857701 for ; Tue, 30 Jan 2024 20:37:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6C1443857701 Authentication-Results: sourceware.org; dmarc=fail (p=quarantine dis=none) header.from=gmx.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=m.gmane-mx.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6C1443857701 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=116.202.254.214 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706647028; cv=none; b=HhHJMQy/VNzyY8zzeOdXtSDPDRv0X+upuzQYfhs+jMHGu9Wb/YSD8rUlgP4YXQlnTEnMwZFtpHJ1yAbmrsaI2uuOlXgaes40N4p60BZFDRCFkS+FfyFPNGOHRQleL0dj8wUSzJUZ/pt1KZnvzAXGqcPGsIL8k+VKf9M/tULEKpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706647028; c=relaxed/simple; bh=3ZaV7FBhMcorFJKFoAU2Gpe5g0EY4AVtcLPEzcQvZRQ=; h=To:From:Subject:Date:Message-ID:Mime-Version; b=VCyMPfCZWqi8qa/+ByvgKF0Z6GzUxdBdDx0SWqVt0oUgg+FfTHt6wzDbhFrE46E+6Zu55bdKQt2hsnrOqxbfaJRkfOcpfp+2hJIB3vym1Pz049z39caxsFl1ZxESdeV9so7CTaLyJyMPciFTg3lLlUQ41iILoQpS/uWKlmM6NEU= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1rUuqu-00058A-FB for gcc-patches@gcc.gnu.org; Tue, 30 Jan 2024 21:37:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: gcc-patches@gcc.gnu.org From: Harald Anlauf Subject: Re: [patch, libgfortran] PR111022 ES0.0E0 format gave ES0.dE0 output with d too high. Date: Tue, 30 Jan 2024 21:36:57 +0100 Message-ID: <830f8286-e41b-4dc2-99c2-8acf789c5d39@gmx.de> References: <472c030d-fc70-4997-b16a-e84a0c97bee2@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla Thunderbird Content-Language: en-US In-Reply-To: <472c030d-fc70-4997-b16a-e84a0c97bee2@gmail.com> Cc: fortran@gcc.gnu.org X-Spam-Status: No, score=-1.5 required=5.0 tests=BAYES_00,BODY_8BITS,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,KAM_DMARC_STATUS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Message-ID: <20240130203657.9gKUmJ3DjfdoCowlqf0NU0zVgWYAPTXbvXm0Tgtb_KU@z> Hi Jerry, Am 30.01.24 um 19:15 schrieb Jerry D: > The attached patch attempts to fix the handling of the EN0.0E0 and > ES0.0E0 formatting by correctly calculating the number of digits needed > for the exponents and building those exponents into the float string. while your patch addresses ENw.dE0 and ESw.dE0 formatting, it does not fix Ew.dE0, which can be seen with the following test: write(buffer,"(E0.3E0)") .6660_4 print *, buffer write(buffer,"(E0.3)") .6660_4 print *, buffer I get even with your patch: 0.666 0.666 but would have expected: 0.666E+0 ! F2018 & F2023, table 13.1 0.666E+0 ! F2023, table 13.1 The latter one is a bit ambiguous in F2018, but certainly gfortran's current output in wrong. Can you please check, and if you can fix that too, it would be great. And if we do not want to be dependent on the standard version at runtime, I'd rather go for F2023. > My editor judiciously deleted trailing blank spaces in a number of > places.  I apologize for the clutter, but we might as well get rid of it > now. > > Two existing test cases needed to be adjusted and I am adding one new > test case to capture the changes in our testsuite. > > Regression tested on X86_64. > > OK for trunk?  Do we need to backport this? If the above is fixed, I would not object a backport to the 13-branch, but only if that change has sinked in for a while, and someone else agrees on it. Thanks so far! Harald > Regards, > > Jerry > > Author: Jerry DeLisle > Date:   Tue Jan 30 09:45:49 2024 -0800 > >     libgfortran: EN0.0E0 and ES0.0E0 format editing. > >             PR libgfortran/111022 > >     F2018 and F2023 standards added zero width exponents. This required >     additional special handing in the process of building formatted >     floating point strings. > >     libgfortran/ChangeLog: > >             * io/write.c (select_buffer): Whitespace. >             (write_real): Whitespace. >             (write_real_w0): Adjust logic for d==0. >             * io/write_float.def (determine_precision): Whitespace. >             (build_float_string): Calculate the width of the E0 exponents. >             (build_infnan_string): Whitespace. >             (CALCULATE_EXP): Whitespace >             (quadmath_snprintf): Whitespace. >             (determine_en_precision): Whitespace. > >     gcc/testsuite/ChangeLog: > >             * gfortran.dg/pr96436_4.f90: Changed for ES0 and EN0. >             * gfortran.dg/pr96436_5.f90: Changed for ES0 and EN0. >             * gfortran.dg/pr111022.f90: New test.