re PR libfortran/21376 (libfortran "E" output format causes FPE)

PR libfortran/21376
	* io/write.c (output_float): Rework logic to avoid call to log10
	with argument equal to zero.

From-SVN: r100068
This commit is contained in:
Peter Wainwright 2005-05-22 21:17:42 +00:00 committed by François-Xavier Coudert
parent 8ba8f7e557
commit c220bdaec9
2 changed files with 11 additions and 2 deletions

View File

@ -1,3 +1,9 @@
2005-05-22 Francois-Xavier Coudert <coudert@clipper.ens.fr>
PR libfortran/21376
* io/write.c (output_float): Rework logic to avoid call to log10
with argument equal to zero.
2005-05-21 Eric Botcazou <ebotcazou@libertysurf.fr>
* configure.ac: Check for trunc and truncf in libm.

View File

@ -296,6 +296,7 @@ output_float (fnode *f, double value)
int nblanks;
int i;
sign_t sign;
double abslog;
ft = f->format;
w = f->u.real.w;
@ -320,9 +321,11 @@ output_float (fnode *f, double value)
edigits = 2;
else
{
edigits = 1 + (int) log10 (fabs(log10 (value)));
if (edigits < 2)
abslog = fabs(log10 (value));
if (abslog < 100)
edigits = 2;
else
edigits = 1 + (int) log10 (abslog);
}
if (ft == FMT_F || ft == FMT_EN