* 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

@ -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.

@ -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

@ -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 */

@ -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);
}

@ -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);