aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--features.h4
-rw-r--r--math/math.h16
-rw-r--r--misc/efgcvt_r.c24
-rw-r--r--sysdeps/i386/fpu/__math.h9
5 files changed, 43 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 45095cf074..7e8e4a82ba 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
Tue Mar 19 14:18:42 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
+ * 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.
+
* features.h (__FAVOR_BSD): Define only if _BSD_SOURCE is defined
and no other _*_SOURCE macro is.
(_GNU_SOURCE): Don't define by default.
diff --git a/features.h b/features.h
index 675eac5d52..de1fe008a2 100644
--- a/features.h
+++ b/features.h
@@ -75,8 +75,8 @@ Cambridge, MA 02139, USA. */
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
#if defined (_BSD_SOURCE) && \
- !(defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) ||
- defiend (_GNU_SOURCE) || defined (_SVID_SOURCE))
+ !(defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) || \
+ defined (_GNU_SOURCE) || defined (_SVID_SOURCE))
#define __FAVOR_BSD 1
#endif
diff --git a/math/math.h b/math/math.h
index 2693fcc9d0..6915a9eb86 100644
--- a/math/math.h
+++ b/math/math.h
@@ -115,13 +115,6 @@ extern int matherr __P ((struct exception *));
#endif
-/* Get machine-dependent inline versions (if there are any). */
-#include <__math.h>
-
-
-__END_DECLS
-
-
#ifdef __USE_BSD
/* Some useful constants. */
#define M_E 2.7182818284590452354 /* e */
@@ -140,4 +133,13 @@ __END_DECLS
#endif
+/* Get machine-dependent inline versions (if there are any). */
+#if defined (__NO_MATH_INLINES) || defined (__OPTIMIZE__)
+#include <__math.h>
+#endif
+
+
+__END_DECLS
+
+
#endif /* math.h */
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);
}
diff --git a/sysdeps/i386/fpu/__math.h b/sysdeps/i386/fpu/__math.h
index 2a759c27cb..c9bae29ba3 100644
--- a/sysdeps/i386/fpu/__math.h
+++ b/sysdeps/i386/fpu/__math.h
@@ -93,7 +93,7 @@ __MATH_INLINE double sin (double __x);
__MATH_INLINE double
sin (double __x)
{
- register double value;
+ register double __value;
__asm __volatile__
("fsin"
: "=t" (__value) : "0" (__x));
@@ -179,7 +179,7 @@ exp (double __x)
"fsub %%st(1) # fract(x * log2(e))\n\t"
"f2xm1 # 2^(fract(x * log2(e))) - 1\n\t"
: "=t" (__value), "=u" (__exponent) : "0" (__x));
- value += 1.0;
+ __value += 1.0;
__asm __volatile__
("fscale"
: "=t" (__value) : "0" (__value), "u" (__exponent));
@@ -372,7 +372,6 @@ hypot (double __x, double __y)
return sqrt (__x * __x + __y * __y);
}
-__MATH_INLINE double __log1p (double __x);
__MATH_INLINE double
log1p (double __x)
{
@@ -396,8 +395,8 @@ asinh (double __x)
{
register double __y = fabs (__x);
- return __log1p ((__y * __y / (sqrt (__y * __y + 1.0) + 1.0) + __y)
- * __sgn1 (__x));
+ return log1p ((__y * __y / (sqrt (__y * __y + 1.0) + 1.0) + __y)
+ * __sgn1 (__x));
}
__MATH_INLINE double __acosh (double __x);