This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [gfortran] PATCH PR20480 zero is written with non-zero exponent
- From: Tobias Schlüter <tobias dot schlueter at physik dot uni-muenchen dot de>
- To: François-Xavier Coudert <Francois-Xavier dot Coudert at ens dot fr>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Wed, 16 Mar 2005 15:48:13 +0100
- Subject: Re: [gfortran] PATCH PR20480 zero is written with non-zero exponent
- References: <20050316142607.GA15147@clipper.ens.fr>
François-Xavier Coudert wrote:
> @@ -411,7 +411,8 @@ output_float (fnode *f, double value, in
> case FMT_EN:
> /* The exponent must be a multiple of three, with 1-3 digits before
> the decimal point. */
> - e--;
> + if (value != 0.0)
> + e--;
> if (e >= 0)
> nbefore = e % 3;
> else
I would prefer if you special cased e == 0 in the code immediately following
the line you changed, because it seems clearer to me, i.e. write
case FMT_EN:
/* The exponent must be a multiple of three, with 1-3 digits before
the decimal point. */
if (value != 0.0)
e--;
if (e == 0)
nbefore = 0
else
{
if (e > 0)
nbefore = e % 3;
else if (e < 0)
{
nbefore = (-e) % 3;
if (nbefore != 0)
nbefore = 3 - nbefore;
}
e -= nbefore;
}
Otherwise ok.
Thanks,
- Tobi