summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1996-03-20 00:18:44 +0000
committerRoland McGrath <roland@gnu.org>1996-03-20 00:18:44 +0000
commit4d5853334045cedb630716aec47e9cae49db3c9f (patch)
treeeddefc007600b42b58d15ad9a9a267c04f5fba60 /misc
parentd3669add24e6ebc86ed25683ff4d4eb7c67e4d56 (diff)
* sysdeps/i386/fpu/__math.h (asinh): Call log1p instead of __log1p.
* math/math.h: Move M_* constants before __math.h include. [__NO_MATH_INLINES || __OPTIMIZE__]: Include __math.h only #if this. * misc/efgcvt_r.c (ecvt_r): Declare floor, log10, fabs as weak extern. If log10 is not defined (i.e. no -lm), use stupid loop instead.
Diffstat (limited to 'misc')
-rw-r--r--misc/efgcvt_r.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/misc/efgcvt_r.c b/misc/efgcvt_r.c
index 6bead573a7..3e33f660c6 100644
--- a/misc/efgcvt_r.c
+++ b/misc/efgcvt_r.c
@@ -1,6 +1,6 @@
/* [efg]cvt -- compatibility functions for floating point formatting,
reentrent versions.
-Copyright (C) 1995 Free Software Foundation, Inc.
+Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -60,6 +60,8 @@ fcvt_r (value, ndigit, decpt, sign, buf, len)
return 0;
}
+weak_symbol (floor) weak_symbol (log10) weak_symbol (fabs)
+
int
ecvt_r (value, ndigit, decpt, sign, buf, len)
double value;
@@ -67,8 +69,22 @@ ecvt_r (value, ndigit, decpt, sign, buf, len)
char *buf;
size_t len;
{
- ndigit -= (int) floor (log10 (value < 0.0 ? -value : value));
- if (ndigit < 0)
- ndigit = 0;
+ if (&log10)
+ {
+ /* Use the reasonable code if -lm is included. */
+ ndigit -= (int) floor (log10 (fabs (value)));
+ if (ndigit < 0)
+ ndigit = 0;
+ }
+ else
+ {
+ /* Slow code that doesn't require -lm functions. */
+ double d;
+ for (d = value < 0.0 ? - value : value;
+ ndigit > 0 && d >= 10.0;
+ d *= 0.1)
+ --ndigit;
+ }
+
return fcvt_r (value, ndigit, decpt, sign, buf, len);
}