[patch, libgfortran] PR111022 ES0.0E0 format gave ES0.dE0 output with d too high.

Jerry D jvdelisle2@gmail.com
Fri Feb 2 02:42:40 GMT 2024


On 1/30/24 12:36 PM, Harald Anlauf wrote:
> 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
> 

An updated patch is attached and gives the expected result.

$ gfc example.f90
$ ./a.out
  0.666E+0
  0.666E+0

I will update the commit log and test cases and re-submit for approval.

Regards,

Jerry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cleanupreview.diff
Type: text/x-patch
Size: 17288 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/fortran/attachments/20240201/efbbb0f5/attachment-0001.bin>


More information about the Fortran mailing list