Commit 37b659dd by Janne Blomqvist

re PR libfortran/52434 (Insufficient number of digits in floating point formatting)

2012-03-15  Janne Blomqvist  <jb@gcc.gnu.org>

        PR libfortran/52434
        PR libfortran/48878
        PR libfortran/38199
        * io/unit.c (get_internal_unit): Default to ROUND_UNSPECIFIED.
        (init_units): Likewise.
        * io/write_float.def (determine_precision): New function.
        (output_float): Take into account buffer with %f format, no need
        for our own rounding if unspecified or processor specified
        rounding.
        (DTOA): Simplify format string, add parameters.
        (FDTOA): New macros similar to DTOA, but using %f format.
        (OUTPUT_FLOAT_FMT_G): Stack allocate newf, determine correct
        precision and fill buffer.
        (EN_PREC): New macro.
        (determine_en_precision): New function.
        (WRITE_FLOAT): For G format, move buffer filling into
        output_float_FMT_G, use FDTOA for F format.
        (write_float): Increase buffer due to F format.

testsuite ChangeLog:

2012-03-15  Janne Blomqvist  <jb@gcc.gnu.org>

        PR libfortran/52434
        PR libfortran/48878
        PR libfortran/38199
        * gfortran.dg/edit_real_1.f90: Don't assume roundTiesToAway.
        * gfortran.dg/round_1.f03: Likewise.

From-SVN: r185433
parent ff63ac4d
2012-03-15 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/52434
PR libfortran/48878
PR libfortran/38199
* gfortran.dg/edit_real_1.f90: Don't assume roundTiesToAway.
* gfortran.dg/round_1.f03: Likewise.
2012-03-15 Jakub Jelinek <jakub@redhat.com> 2012-03-15 Jakub Jelinek <jakub@redhat.com>
Andrew Pinski <apinski@cavium.com> Andrew Pinski <apinski@cavium.com>
......
...@@ -68,7 +68,7 @@ program edit_real_1 ...@@ -68,7 +68,7 @@ program edit_real_1
if (s .ne. '12.345E-01z') call abort if (s .ne. '12.345E-01z') call abort
! E format, negative scale factor ! E format, negative scale factor
s = x s = x
write (s, '(-2PE10.4,A)') 1.25, "z" write (s, '(-2PE10.4,A)') 1.250001, "z"
if (s .ne. '0.0013E+03z') call abort if (s .ne. '0.0013E+03z') call abort
! E format, single digit precision ! E format, single digit precision
s = x s = x
......
...@@ -20,9 +20,9 @@ write(line, fmt(4)) 1.20, 1.22, 1.25, 1.27, 1.30, 1.125 ...@@ -20,9 +20,9 @@ write(line, fmt(4)) 1.20, 1.22, 1.25, 1.27, 1.30, 1.125
if (line.ne." 1.20 1.22 1.25 1.27 1.30 1.12") call abort if (line.ne." 1.20 1.22 1.25 1.27 1.30 1.12") call abort
write(line, fmt(5)) 1.20, 1.22, 1.25, 1.27, 1.30, 1.125 write(line, fmt(5)) 1.20, 1.22, 1.25, 1.27, 1.30, 1.125
if (line.ne." 1.20 1.22 1.25 1.27 1.30 1.13") call abort if (line.ne." 1.20 1.22 1.25 1.27 1.30 1.13") call abort
write(line, fmt(6)) 1.20, 1.22, 1.25, 1.27, 1.30, 1.125 write(line, fmt(6)) 1.20, 1.22, 1.250001, 1.27, 1.30, 1.125
if (line.ne." 1.2 1.2 1.3 1.3 1.3 1.1") call abort if (line.ne." 1.2 1.2 1.3 1.3 1.3 1.1") call abort
write(line, fmt(7)) 1.20, 1.22, 1.25, 1.27, 1.30, 1.125 write(line, fmt(7)) 1.20, 1.22, 1.250001, 1.27, 1.30, 1.125
if (line.ne." +1.2 +1.2 +1.3 +1.3 +1.3 +1.1") call abort if (line.ne." +1.2 +1.2 +1.3 +1.3 +1.3 +1.1") call abort
end end
2012-03-15 Janne Blomqvist <jb@gcc.gnu.org>
PR libfortran/52434
PR libfortran/48878
PR libfortran/38199
* io/unit.c (get_internal_unit): Default to ROUND_UNSPECIFIED.
(init_units): Likewise.
* io/write_float.def (determine_precision): New function.
(output_float): Take into account buffer with %f format, no need
for our own rounding if unspecified or processor specified
rounding.
(DTOA): Simplify format string, add parameters.
(FDTOA): New macros similar to DTOA, but using %f format.
(OUTPUT_FLOAT_FMT_G): Stack allocate newf, determine correct
precision and fill buffer.
(EN_PREC): New macro.
(determine_en_precision): New function.
(WRITE_FLOAT): For G format, move buffer filling into
output_float_FMT_G, use FDTOA for F format.
(write_float): Increase buffer due to F format.
2012-03-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> 2012-03-14 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* intrinsics/c99_functions.c [__sgi__ && !HAVE_COMPLEX_H]: Remove. * intrinsics/c99_functions.c [__sgi__ && !HAVE_COMPLEX_H]: Remove.
......
...@@ -453,7 +453,7 @@ get_internal_unit (st_parameter_dt *dtp) ...@@ -453,7 +453,7 @@ get_internal_unit (st_parameter_dt *dtp)
iunit->flags.decimal = DECIMAL_POINT; iunit->flags.decimal = DECIMAL_POINT;
iunit->flags.encoding = ENCODING_DEFAULT; iunit->flags.encoding = ENCODING_DEFAULT;
iunit->flags.async = ASYNC_NO; iunit->flags.async = ASYNC_NO;
iunit->flags.round = ROUND_COMPATIBLE; iunit->flags.round = ROUND_UNSPECIFIED;
/* Initialize the data transfer parameters. */ /* Initialize the data transfer parameters. */
...@@ -543,7 +543,7 @@ init_units (void) ...@@ -543,7 +543,7 @@ init_units (void)
u->flags.decimal = DECIMAL_POINT; u->flags.decimal = DECIMAL_POINT;
u->flags.encoding = ENCODING_DEFAULT; u->flags.encoding = ENCODING_DEFAULT;
u->flags.async = ASYNC_NO; u->flags.async = ASYNC_NO;
u->flags.round = ROUND_COMPATIBLE; u->flags.round = ROUND_UNSPECIFIED;
u->recl = options.default_recl; u->recl = options.default_recl;
u->endfile = NO_ENDFILE; u->endfile = NO_ENDFILE;
...@@ -573,7 +573,7 @@ init_units (void) ...@@ -573,7 +573,7 @@ init_units (void)
u->flags.decimal = DECIMAL_POINT; u->flags.decimal = DECIMAL_POINT;
u->flags.encoding = ENCODING_DEFAULT; u->flags.encoding = ENCODING_DEFAULT;
u->flags.async = ASYNC_NO; u->flags.async = ASYNC_NO;
u->flags.round = ROUND_COMPATIBLE; u->flags.round = ROUND_UNSPECIFIED;
u->recl = options.default_recl; u->recl = options.default_recl;
u->endfile = AT_ENDFILE; u->endfile = AT_ENDFILE;
...@@ -603,7 +603,7 @@ init_units (void) ...@@ -603,7 +603,7 @@ init_units (void)
u->flags.decimal = DECIMAL_POINT; u->flags.decimal = DECIMAL_POINT;
u->flags.encoding = ENCODING_DEFAULT; u->flags.encoding = ENCODING_DEFAULT;
u->flags.async = ASYNC_NO; u->flags.async = ASYNC_NO;
u->flags.round = ROUND_COMPATIBLE; u->flags.round = ROUND_UNSPECIFIED;
u->recl = options.default_recl; u->recl = options.default_recl;
u->endfile = AT_ENDFILE; u->endfile = AT_ENDFILE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment