* 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.
This commit is contained in:
Roland McGrath 1996-03-20 00:18:44 +00:00
parent d3669add24
commit 4d58533340
5 changed files with 43 additions and 18 deletions

View File

@ -1,5 +1,13 @@
Tue Mar 19 14:18:42 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu> 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 * features.h (__FAVOR_BSD): Define only if _BSD_SOURCE is defined
and no other _*_SOURCE macro is. and no other _*_SOURCE macro is.
(_GNU_SOURCE): Don't define by default. (_GNU_SOURCE): Don't define by default.

View File

@ -75,8 +75,8 @@ Cambridge, MA 02139, USA. */
/* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */ /* If _BSD_SOURCE was defined by the user, favor BSD over POSIX. */
#if defined (_BSD_SOURCE) && \ #if defined (_BSD_SOURCE) && \
!(defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) || !(defined (_POSIX_SOURCE) || defined (_POSIX_C_SOURCE) || \
defiend (_GNU_SOURCE) || defined (_SVID_SOURCE)) defined (_GNU_SOURCE) || defined (_SVID_SOURCE))
#define __FAVOR_BSD 1 #define __FAVOR_BSD 1
#endif #endif

View File

@ -115,13 +115,6 @@ extern int matherr __P ((struct exception *));
#endif #endif
/* Get machine-dependent inline versions (if there are any). */
#include <__math.h>
__END_DECLS
#ifdef __USE_BSD #ifdef __USE_BSD
/* Some useful constants. */ /* Some useful constants. */
#define M_E 2.7182818284590452354 /* e */ #define M_E 2.7182818284590452354 /* e */
@ -140,4 +133,13 @@ __END_DECLS
#endif #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 */ #endif /* math.h */

View File

@ -1,6 +1,6 @@
/* [efg]cvt -- compatibility functions for floating point formatting, /* [efg]cvt -- compatibility functions for floating point formatting,
reentrent versions. 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. This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or 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; return 0;
} }
weak_symbol (floor) weak_symbol (log10) weak_symbol (fabs)
int int
ecvt_r (value, ndigit, decpt, sign, buf, len) ecvt_r (value, ndigit, decpt, sign, buf, len)
double value; double value;
@ -67,8 +69,22 @@ ecvt_r (value, ndigit, decpt, sign, buf, len)
char *buf; char *buf;
size_t len; size_t len;
{ {
ndigit -= (int) floor (log10 (value < 0.0 ? -value : value)); if (&log10)
if (ndigit < 0) {
ndigit = 0; /* 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); return fcvt_r (value, ndigit, decpt, sign, buf, len);
} }

View File

@ -93,7 +93,7 @@ __MATH_INLINE double sin (double __x);
__MATH_INLINE double __MATH_INLINE double
sin (double __x) sin (double __x)
{ {
register double value; register double __value;
__asm __volatile__ __asm __volatile__
("fsin" ("fsin"
: "=t" (__value) : "0" (__x)); : "=t" (__value) : "0" (__x));
@ -179,7 +179,7 @@ exp (double __x)
"fsub %%st(1) # fract(x * log2(e))\n\t" "fsub %%st(1) # fract(x * log2(e))\n\t"
"f2xm1 # 2^(fract(x * log2(e))) - 1\n\t" "f2xm1 # 2^(fract(x * log2(e))) - 1\n\t"
: "=t" (__value), "=u" (__exponent) : "0" (__x)); : "=t" (__value), "=u" (__exponent) : "0" (__x));
value += 1.0; __value += 1.0;
__asm __volatile__ __asm __volatile__
("fscale" ("fscale"
: "=t" (__value) : "0" (__value), "u" (__exponent)); : "=t" (__value) : "0" (__value), "u" (__exponent));
@ -372,7 +372,6 @@ hypot (double __x, double __y)
return sqrt (__x * __x + __y * __y); return sqrt (__x * __x + __y * __y);
} }
__MATH_INLINE double __log1p (double __x);
__MATH_INLINE double __MATH_INLINE double
log1p (double __x) log1p (double __x)
{ {
@ -396,8 +395,8 @@ asinh (double __x)
{ {
register double __y = fabs (__x); register double __y = fabs (__x);
return __log1p ((__y * __y / (sqrt (__y * __y + 1.0) + 1.0) + __y) return log1p ((__y * __y / (sqrt (__y * __y + 1.0) + 1.0) + __y)
* __sgn1 (__x)); * __sgn1 (__x));
} }
__MATH_INLINE double __acosh (double __x); __MATH_INLINE double __acosh (double __x);