Commit c220bdae by Peter Wainwright Committed by François-Xavier Coudert

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
parent 8ba8f7e5
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.
......
......@@ -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
......
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