2000-02-18 03:39:52 +08:00
|
|
|
#ifndef _MATH_H_
|
2007-07-12 02:09:08 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#define _MATH_H_
|
|
|
|
|
|
|
|
#include <sys/reent.h>
|
|
|
|
#include <machine/ieeefp.h>
|
|
|
|
#include "_ansi.h"
|
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
_BEGIN_STD_C
|
|
|
|
|
2009-05-16 00:15:57 +08:00
|
|
|
/* __dmath, __fmath, and __ldmath are only here for backwards compatibility
|
|
|
|
* in case any code used them. They are no longer used by Newlib, itself,
|
|
|
|
* other than legacy. */
|
2000-02-18 03:39:52 +08:00
|
|
|
union __dmath
|
|
|
|
{
|
|
|
|
double d;
|
2009-05-16 00:15:57 +08:00
|
|
|
__ULong i[2];
|
2000-02-18 03:39:52 +08:00
|
|
|
};
|
2007-05-17 03:59:40 +08:00
|
|
|
|
2005-10-21 05:42:33 +08:00
|
|
|
union __fmath
|
|
|
|
{
|
|
|
|
float f;
|
2009-05-16 00:15:57 +08:00
|
|
|
__ULong i[1];
|
2005-10-21 05:42:33 +08:00
|
|
|
};
|
2007-05-17 03:59:40 +08:00
|
|
|
|
2009-05-16 00:15:57 +08:00
|
|
|
#if defined(_HAVE_LONG_DOUBLE)
|
2005-10-15 05:11:39 +08:00
|
|
|
union __ldmath
|
|
|
|
{
|
2009-05-16 00:15:57 +08:00
|
|
|
long double ld;
|
2005-10-15 05:11:39 +08:00
|
|
|
__ULong i[4];
|
|
|
|
};
|
2009-05-16 00:15:57 +08:00
|
|
|
#endif
|
2005-10-15 05:11:39 +08:00
|
|
|
|
2007-09-07 23:30:59 +08:00
|
|
|
/* Natural log of 2 */
|
2010-12-04 00:08:48 +08:00
|
|
|
#define _M_LN2 0.693147180559945309417
|
2007-09-07 03:51:46 +08:00
|
|
|
|
2012-10-17 02:45:24 +08:00
|
|
|
#if __GNUC_PREREQ (3, 3)
|
2005-10-21 05:42:33 +08:00
|
|
|
/* gcc >= 3.3 implicitly defines builtins for HUGE_VALx values. */
|
|
|
|
|
2007-05-17 03:59:40 +08:00
|
|
|
# ifndef HUGE_VAL
|
|
|
|
# define HUGE_VAL (__builtin_huge_val())
|
|
|
|
# endif
|
2005-10-21 05:42:33 +08:00
|
|
|
|
2007-05-17 03:59:40 +08:00
|
|
|
# ifndef HUGE_VALF
|
|
|
|
# define HUGE_VALF (__builtin_huge_valf())
|
|
|
|
# endif
|
2005-10-21 05:42:33 +08:00
|
|
|
|
2007-05-17 03:59:40 +08:00
|
|
|
# ifndef HUGE_VALL
|
|
|
|
# define HUGE_VALL (__builtin_huge_vall())
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef INFINITY
|
|
|
|
# define INFINITY (__builtin_inff())
|
|
|
|
# endif
|
|
|
|
|
|
|
|
# ifndef NAN
|
|
|
|
# define NAN (__builtin_nanf(""))
|
|
|
|
# endif
|
2005-10-21 05:42:33 +08:00
|
|
|
|
|
|
|
#else /* !gcc >= 3.3 */
|
|
|
|
|
2009-05-16 00:15:57 +08:00
|
|
|
/* No builtins. Use fixed defines instead. (All 3 HUGE plus the INFINITY
|
|
|
|
* and NAN macros are required to be constant expressions. Using a variable--
|
|
|
|
* even a static const--does not meet this requirement, as it cannot be
|
|
|
|
* evaluated at translation time.)
|
|
|
|
* The infinities are done using numbers that are far in excess of
|
|
|
|
* something that would be expected to be encountered in a floating-point
|
|
|
|
* implementation. (A more certain way uses values from float.h, but that is
|
|
|
|
* avoided because system includes are not supposed to include each other.)
|
|
|
|
* This method might produce warnings from some compilers. (It does in
|
|
|
|
* newer GCCs, but not for ones that would hit this #else.) If this happens,
|
|
|
|
* please report details to the Newlib mailing list. */
|
2005-10-21 05:42:33 +08:00
|
|
|
|
|
|
|
#ifndef HUGE_VAL
|
2009-05-16 00:15:57 +08:00
|
|
|
#define HUGE_VAL (1.0e999999999)
|
2005-10-21 05:42:33 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef HUGE_VALF
|
2009-05-16 00:15:57 +08:00
|
|
|
#define HUGE_VALF (1.0e999999999F)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(HUGE_VALL) && defined(_HAVE_LONG_DOUBLE)
|
|
|
|
#define HUGE_VALL (1.0e999999999L)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if !defined(INFINITY)
|
|
|
|
#define INFINITY (HUGE_VALF)
|
2005-10-21 05:42:33 +08:00
|
|
|
#endif
|
2000-07-29 00:27:55 +08:00
|
|
|
|
2009-05-16 00:15:57 +08:00
|
|
|
#if !defined(NAN)
|
|
|
|
#if defined(__GNUC__) && defined(__cplusplus)
|
|
|
|
/* Exception: older g++ versions warn about the divide by 0 used in the
|
|
|
|
* normal case (even though older gccs do not). This trick suppresses the
|
|
|
|
* warning, but causes errors for plain gcc, so is only used in the one
|
|
|
|
* special case. */
|
|
|
|
static const union { __ULong __i[1]; float __d; } __Nanf = {0x7FC00000};
|
|
|
|
#define NAN (__Nanf.__d)
|
|
|
|
#else
|
|
|
|
#define NAN (0.0F/0.0F)
|
|
|
|
#endif
|
2005-10-21 05:42:33 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2005-10-21 05:42:33 +08:00
|
|
|
#endif /* !gcc >= 3.3 */
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
/* Reentrant ANSI C functions. */
|
|
|
|
|
|
|
|
#ifndef __math_68881
|
|
|
|
extern double atan _PARAMS((double));
|
|
|
|
extern double cos _PARAMS((double));
|
|
|
|
extern double sin _PARAMS((double));
|
|
|
|
extern double tan _PARAMS((double));
|
|
|
|
extern double tanh _PARAMS((double));
|
|
|
|
extern double frexp _PARAMS((double, int *));
|
|
|
|
extern double modf _PARAMS((double, double *));
|
|
|
|
extern double ceil _PARAMS((double));
|
|
|
|
extern double fabs _PARAMS((double));
|
|
|
|
extern double floor _PARAMS((double));
|
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
|
|
|
|
/* Non reentrant ANSI C functions. */
|
|
|
|
|
|
|
|
#ifndef _REENT_ONLY
|
2009-04-04 01:42:27 +08:00
|
|
|
#ifndef __math_68881
|
2000-02-18 03:39:52 +08:00
|
|
|
extern double acos _PARAMS((double));
|
|
|
|
extern double asin _PARAMS((double));
|
|
|
|
extern double atan2 _PARAMS((double, double));
|
|
|
|
extern double cosh _PARAMS((double));
|
|
|
|
extern double sinh _PARAMS((double));
|
|
|
|
extern double exp _PARAMS((double));
|
|
|
|
extern double ldexp _PARAMS((double, int));
|
|
|
|
extern double log _PARAMS((double));
|
|
|
|
extern double log10 _PARAMS((double));
|
|
|
|
extern double pow _PARAMS((double, double));
|
|
|
|
extern double sqrt _PARAMS((double));
|
|
|
|
extern double fmod _PARAMS((double, double));
|
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
|
|
|
|
2007-07-12 02:09:08 +08:00
|
|
|
#if !defined(__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2002-06-08 05:59:57 +08:00
|
|
|
/* ISO C99 types and macros. */
|
|
|
|
|
2012-12-19 05:20:51 +08:00
|
|
|
/* FIXME: FLT_EVAL_METHOD should somehow be gotten from float.h (which is hard,
|
|
|
|
* considering that the standard says the includes it defines should not
|
|
|
|
* include other includes that it defines) and that value used. (This can be
|
|
|
|
* solved, but autoconf has a bug which makes the solution more difficult, so
|
|
|
|
* it has been skipped for now.) */
|
|
|
|
#if !defined(FLT_EVAL_METHOD) && defined(__FLT_EVAL_METHOD__)
|
|
|
|
#define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
|
|
|
|
#define __TMP_FLT_EVAL_METHOD
|
2002-06-08 05:59:57 +08:00
|
|
|
#endif /* FLT_EVAL_METHOD */
|
2012-12-19 05:20:51 +08:00
|
|
|
#if defined FLT_EVAL_METHOD
|
|
|
|
#if FLT_EVAL_METHOD == 0
|
|
|
|
typedef float float_t;
|
|
|
|
typedef double double_t;
|
|
|
|
#elif FLT_EVAL_METHOD == 1
|
|
|
|
typedef double float_t;
|
|
|
|
typedef double double_t;
|
|
|
|
#elif FLT_EVAL_METHOD == 2
|
|
|
|
typedef long double float_t;
|
|
|
|
typedef long double double_t;
|
|
|
|
#else
|
|
|
|
/* Implementation-defined. Assume float_t and double_t have been
|
|
|
|
* defined previously for this configuration (e.g. config.h). */
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
/* Assume basic definitions. */
|
|
|
|
typedef float float_t;
|
|
|
|
typedef double double_t;
|
|
|
|
#endif
|
|
|
|
#if defined(__TMP_FLT_EVAL_METHOD)
|
|
|
|
#undef FLT_EVAL_METHOD
|
|
|
|
#endif
|
2002-06-08 05:59:57 +08:00
|
|
|
|
|
|
|
#define FP_NAN 0
|
|
|
|
#define FP_INFINITE 1
|
|
|
|
#define FP_ZERO 2
|
|
|
|
#define FP_SUBNORMAL 3
|
|
|
|
#define FP_NORMAL 4
|
|
|
|
|
2007-05-17 03:59:40 +08:00
|
|
|
#ifndef FP_ILOGB0
|
|
|
|
# define FP_ILOGB0 (-INT_MAX)
|
|
|
|
#endif
|
|
|
|
#ifndef FP_ILOGBNAN
|
|
|
|
# define FP_ILOGBNAN INT_MAX
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MATH_ERRNO
|
|
|
|
# define MATH_ERRNO 1
|
|
|
|
#endif
|
|
|
|
#ifndef MATH_ERREXCEPT
|
|
|
|
# define MATH_ERREXCEPT 2
|
|
|
|
#endif
|
|
|
|
#ifndef math_errhandling
|
|
|
|
# define math_errhandling MATH_ERRNO
|
|
|
|
#endif
|
|
|
|
|
2006-02-28 07:51:28 +08:00
|
|
|
extern int __isinff (float x);
|
|
|
|
extern int __isinfd (double x);
|
|
|
|
extern int __isnanf (float x);
|
|
|
|
extern int __isnand (double x);
|
2002-06-08 05:59:57 +08:00
|
|
|
extern int __fpclassifyf (float x);
|
|
|
|
extern int __fpclassifyd (double x);
|
2003-08-14 01:36:10 +08:00
|
|
|
extern int __signbitf (float x);
|
|
|
|
extern int __signbitd (double x);
|
2002-06-08 05:59:57 +08:00
|
|
|
|
2009-06-16 23:55:06 +08:00
|
|
|
#define fpclassify(__x) \
|
|
|
|
((sizeof(__x) == sizeof(float)) ? __fpclassifyf(__x) : \
|
|
|
|
__fpclassifyd(__x))
|
2002-06-08 05:59:57 +08:00
|
|
|
|
2007-04-27 03:23:37 +08:00
|
|
|
#ifndef isfinite
|
2009-06-16 23:55:06 +08:00
|
|
|
#define isfinite(__y) \
|
|
|
|
(__extension__ ({int __cy = fpclassify(__y); \
|
|
|
|
__cy != FP_INFINITE && __cy != FP_NAN;}))
|
2007-04-27 03:23:37 +08:00
|
|
|
#endif
|
2006-02-28 07:51:28 +08:00
|
|
|
|
|
|
|
/* Note: isinf and isnan were once functions in newlib that took double
|
|
|
|
* arguments. C99 specifies that these names are reserved for macros
|
|
|
|
* supporting multiple floating point types. Thus, they are
|
|
|
|
* now defined as macros. Implementations of the old functions
|
2009-07-10 01:04:56 +08:00
|
|
|
* taking double arguments still exist for compatibility purposes
|
|
|
|
* (prototypes for them are in <ieeefp.h>). */
|
2007-04-27 03:23:37 +08:00
|
|
|
#ifndef isinf
|
2009-06-16 23:55:06 +08:00
|
|
|
#define isinf(y) (fpclassify(y) == FP_INFINITE)
|
2007-04-27 03:23:37 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef isnan
|
2009-06-16 23:55:06 +08:00
|
|
|
#define isnan(y) (fpclassify(y) == FP_NAN)
|
2007-04-27 03:23:37 +08:00
|
|
|
#endif
|
|
|
|
|
2006-02-28 07:51:28 +08:00
|
|
|
#define isnormal(y) (fpclassify(y) == FP_NORMAL)
|
2009-06-16 23:55:06 +08:00
|
|
|
#define signbit(__x) \
|
|
|
|
((sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \
|
|
|
|
__signbitd(__x))
|
2002-06-08 05:59:57 +08:00
|
|
|
|
|
|
|
#define isgreater(x,y) \
|
|
|
|
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
|
|
!isunordered(__x,__y) && (__x > __y);}))
|
|
|
|
#define isgreaterequal(x,y) \
|
|
|
|
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
|
|
!isunordered(__x,__y) && (__x >= __y);}))
|
|
|
|
#define isless(x,y) \
|
|
|
|
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
|
|
!isunordered(__x,__y) && (__x < __y);}))
|
|
|
|
#define islessequal(x,y) \
|
|
|
|
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
|
|
!isunordered(__x,__y) && (__x <= __y);}))
|
|
|
|
#define islessgreater(x,y) \
|
|
|
|
(__extension__ ({__typeof__(x) __x = (x); __typeof__(y) __y = (y); \
|
|
|
|
!isunordered(__x,__y) && (__x < __y || __x > __y);}))
|
|
|
|
|
2005-02-08 05:04:22 +08:00
|
|
|
#define isunordered(a,b) \
|
|
|
|
(__extension__ ({__typeof__(a) __a = (a); __typeof__(b) __b = (b); \
|
|
|
|
fpclassify(__a) == FP_NAN || fpclassify(__b) == FP_NAN;}))
|
2002-06-08 05:59:57 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
/* Non ANSI double precision functions. */
|
|
|
|
|
|
|
|
extern double infinity _PARAMS((void));
|
2003-07-10 01:52:31 +08:00
|
|
|
extern double nan _PARAMS((const char *));
|
2000-02-18 03:39:52 +08:00
|
|
|
extern int finite _PARAMS((double));
|
|
|
|
extern double copysign _PARAMS((double, double));
|
2009-11-18 06:35:46 +08:00
|
|
|
extern double logb _PARAMS((double));
|
2000-02-18 03:39:52 +08:00
|
|
|
extern int ilogb _PARAMS((double));
|
|
|
|
|
|
|
|
extern double asinh _PARAMS((double));
|
|
|
|
extern double cbrt _PARAMS((double));
|
|
|
|
extern double nextafter _PARAMS((double, double));
|
|
|
|
extern double rint _PARAMS((double));
|
|
|
|
extern double scalbn _PARAMS((double, int));
|
|
|
|
|
2002-06-08 05:59:57 +08:00
|
|
|
extern double exp2 _PARAMS((double));
|
|
|
|
extern double scalbln _PARAMS((double, long int));
|
|
|
|
extern double tgamma _PARAMS((double));
|
|
|
|
extern double nearbyint _PARAMS((double));
|
|
|
|
extern long int lrint _PARAMS((double));
|
2008-04-24 07:10:54 +08:00
|
|
|
extern _LONG_LONG_TYPE int llrint _PARAMS((double));
|
2002-06-08 05:59:57 +08:00
|
|
|
extern double round _PARAMS((double));
|
|
|
|
extern long int lround _PARAMS((double));
|
2009-03-25 Craig Howland <howland@LGSInnovations.com>
* libc/include/math.h: (llround, llroundf): Declare.
* libm/common/s_llround.c: New file, implementing llround().
* libm/common/sf_llround.c: New file, implementing llroundf().
* libm/common/sf_lround.c: Remove spurious cast in _DOUBLE_IS_32BITS
version of function.
* libm/common/sf_lrint.c: Ditto.
* libm/common/sf_logb.c: Corrected return for subnormal argument
by replacing existing function with a version created from sf_ilogb.c.
* libm/common/s_logb.c: Ditto, except starting point s_ilogb.c. Also
added documentation for logb() and logbf().
* libm/common/s_signbit.c: Add signbit() documentation.
* libm/common/s_log2.c: Update return values to match what w_log2.c has,
since log2 uses log(); add note about being derived instead of direct.
* libm/common/sf_fma.c: Add casts to attempt to get correct results,
as well as comments pointing out problems with the implementation.
* libm/common/s_fma.c: Add fma() and fmaf() documentation.
* libm/common/sf_remquo.c: Incorrect quotient returns for large values
corrected by discarding existing function and replacing with Sun
verion, with some enhancements.
* libm/common/s_remquo.c: Ditto. Add remquo() and remquof()
documentation.
* libm/common/s_fmax.c: Add fmax() and fmaxf() documentation.
* libm/common/s_fmin.c: Add fmin() and fminf() documentation.
* libm/common/s_fdim.c: Return NAN for NAN arg, add fdim() and fdimf()
documentation.
* libm/common/sf_fdim.c: Return NAN for NAN arg, HUGE_VALF for inf arg.
* libm/common/s_trunc.c: Add trunc() and truncf() documentation.
* libm/common/s_rint.c: Add rint() and rintf() documentation.
* libm/common/s_round.c: Add round() and roundf() documentation.
* libm/common/s_scalbn.c: Add scalbln() and scalblnf() documentation.
* libm/common/s_infinity.c: Add infinity() and infinityf()
documentation.
* libm/common/s_lround.c: Add lround(), lroundf(), llround(), and
llroundf() documentation.
* libm/common/s_lrint.c: Add lrint(), lrintf(), llrint(), and llrintf()
documentation.
* libm/common/isgreater.c: New file for documenting math.h function-like
macros isgreater(), isgreaterequal(), isless(), islessequal(),
islessgreater(), and isunordered().
* libm/common/s_isnan.c: Add documentation for function-like macros
fpclassify(), isfinite(), isinf(), isnan(), and isnormal().
* libm/common/s_nearbyint.c: Add nearbyint() and nearbyintf()
documentation.
* libm/common/Makefile.am: Add s_llround.c (src); sf_llround.c (fsrc);
s_fdim.def, s_fma.def, s_fmax.def, s_fmin.def,
s_logb.def, s_lrint.def, s_lround.def, s_nearbyint.def, s_remquo.def,
s_rint.def, s_round.def, s_signbit.def, s_trunc.def, and
isgreater.def (chobj);
re-name all existing chew files (chobj) to match source file base
names (put in underscores), delete all special targets for chew files
(leaving all to be generated by rule).
* libm/common/Makefile.in: regenerate.
* libm/math/w_exp2.c: Add "base 2" to documentation description (and
delete TRAD_SYNOPSIS).
* libm/math/w_gamma.c: Add tgamma() and tgammaf() documentation, along
with some history behind the function names.
* libm/math/math.tex: Add includes for newly-added documentation (see
.def additions to common/Makefile.am and math/Makefile.am in this
ChangeLog list), adjusted existing .def file names to match source file
base names (added underscores); add mention of HUGE_VALF; rename
"Version of library" section to "Error Handling" and add some text
about floating-point exception; added section "Standards Compliance And
Portability".
* libm/math/Makefile.am: Add w_exp2.def (chobj);
re-name all existing chew files (chobj) to match source file base
names, delete all special targets for chew files (leaving all to be
generated by rule).
* libm/math/Makefile.in: regenerated
* doc/makedoc.c: Change silent ignoring of commands < 5 characters
to a failure when reading macro file for commands < 4 characters;
add -v (verbose) option for printing some debugging information;
get rid of spurious translation of "@*" to "*" (no source files used @*,
so no existing doc pages were affected); clean up some compiler
warnings.
* doc/doc.str: add BUGS and SEEALSO sections (to match texi2pod.pl
which has them); Remove ITEM command (redundant with makedoc built-in
"o", not used in any present source file so nothing is lost, anyway).
* HOWTO: New file to hold information for maintainers regarding how
to do things. Initial sections on documentation and ELIX levels.
2009-03-26 03:13:24 +08:00
|
|
|
extern long long int llround _PARAMS((double));
|
2002-06-08 05:59:57 +08:00
|
|
|
extern double trunc _PARAMS((double));
|
|
|
|
extern double remquo _PARAMS((double, double, int *));
|
|
|
|
extern double fdim _PARAMS((double, double));
|
|
|
|
extern double fmax _PARAMS((double, double));
|
|
|
|
extern double fmin _PARAMS((double, double));
|
|
|
|
extern double fma _PARAMS((double, double, double));
|
2007-05-18 02:50:57 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifndef __math_68881
|
|
|
|
extern double log1p _PARAMS((double));
|
|
|
|
extern double expm1 _PARAMS((double));
|
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
|
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
extern double acosh _PARAMS((double));
|
|
|
|
extern double atanh _PARAMS((double));
|
|
|
|
extern double remainder _PARAMS((double, double));
|
|
|
|
extern double gamma _PARAMS((double));
|
|
|
|
extern double lgamma _PARAMS((double));
|
|
|
|
extern double erf _PARAMS((double));
|
|
|
|
extern double erfc _PARAMS((double));
|
2009-03-19 02:11:18 +08:00
|
|
|
extern double log2 _PARAMS((double));
|
2010-01-12 06:55:47 +08:00
|
|
|
#if !defined(__cplusplus)
|
2010-12-04 00:08:48 +08:00
|
|
|
#define log2(x) (log (x) / _M_LN2)
|
2010-01-12 06:55:47 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
#ifndef __math_68881
|
|
|
|
extern double hypot _PARAMS((double, double));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
|
|
|
|
|
|
|
/* Single precision versions of ANSI functions. */
|
|
|
|
|
|
|
|
extern float atanf _PARAMS((float));
|
|
|
|
extern float cosf _PARAMS((float));
|
|
|
|
extern float sinf _PARAMS((float));
|
|
|
|
extern float tanf _PARAMS((float));
|
|
|
|
extern float tanhf _PARAMS((float));
|
|
|
|
extern float frexpf _PARAMS((float, int *));
|
|
|
|
extern float modff _PARAMS((float, float *));
|
|
|
|
extern float ceilf _PARAMS((float));
|
|
|
|
extern float fabsf _PARAMS((float));
|
|
|
|
extern float floorf _PARAMS((float));
|
|
|
|
|
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
extern float acosf _PARAMS((float));
|
|
|
|
extern float asinf _PARAMS((float));
|
|
|
|
extern float atan2f _PARAMS((float, float));
|
|
|
|
extern float coshf _PARAMS((float));
|
|
|
|
extern float sinhf _PARAMS((float));
|
|
|
|
extern float expf _PARAMS((float));
|
|
|
|
extern float ldexpf _PARAMS((float, int));
|
|
|
|
extern float logf _PARAMS((float));
|
|
|
|
extern float log10f _PARAMS((float));
|
|
|
|
extern float powf _PARAMS((float, float));
|
|
|
|
extern float sqrtf _PARAMS((float));
|
|
|
|
extern float fmodf _PARAMS((float, float));
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
|
|
|
|
|
|
|
/* Other single precision functions. */
|
|
|
|
|
2002-06-08 05:59:57 +08:00
|
|
|
extern float exp2f _PARAMS((float));
|
|
|
|
extern float scalblnf _PARAMS((float, long int));
|
|
|
|
extern float tgammaf _PARAMS((float));
|
|
|
|
extern float nearbyintf _PARAMS((float));
|
|
|
|
extern long int lrintf _PARAMS((float));
|
2008-04-24 07:10:54 +08:00
|
|
|
extern _LONG_LONG_TYPE llrintf _PARAMS((float));
|
2002-06-08 05:59:57 +08:00
|
|
|
extern float roundf _PARAMS((float));
|
|
|
|
extern long int lroundf _PARAMS((float));
|
2009-03-25 Craig Howland <howland@LGSInnovations.com>
* libc/include/math.h: (llround, llroundf): Declare.
* libm/common/s_llround.c: New file, implementing llround().
* libm/common/sf_llround.c: New file, implementing llroundf().
* libm/common/sf_lround.c: Remove spurious cast in _DOUBLE_IS_32BITS
version of function.
* libm/common/sf_lrint.c: Ditto.
* libm/common/sf_logb.c: Corrected return for subnormal argument
by replacing existing function with a version created from sf_ilogb.c.
* libm/common/s_logb.c: Ditto, except starting point s_ilogb.c. Also
added documentation for logb() and logbf().
* libm/common/s_signbit.c: Add signbit() documentation.
* libm/common/s_log2.c: Update return values to match what w_log2.c has,
since log2 uses log(); add note about being derived instead of direct.
* libm/common/sf_fma.c: Add casts to attempt to get correct results,
as well as comments pointing out problems with the implementation.
* libm/common/s_fma.c: Add fma() and fmaf() documentation.
* libm/common/sf_remquo.c: Incorrect quotient returns for large values
corrected by discarding existing function and replacing with Sun
verion, with some enhancements.
* libm/common/s_remquo.c: Ditto. Add remquo() and remquof()
documentation.
* libm/common/s_fmax.c: Add fmax() and fmaxf() documentation.
* libm/common/s_fmin.c: Add fmin() and fminf() documentation.
* libm/common/s_fdim.c: Return NAN for NAN arg, add fdim() and fdimf()
documentation.
* libm/common/sf_fdim.c: Return NAN for NAN arg, HUGE_VALF for inf arg.
* libm/common/s_trunc.c: Add trunc() and truncf() documentation.
* libm/common/s_rint.c: Add rint() and rintf() documentation.
* libm/common/s_round.c: Add round() and roundf() documentation.
* libm/common/s_scalbn.c: Add scalbln() and scalblnf() documentation.
* libm/common/s_infinity.c: Add infinity() and infinityf()
documentation.
* libm/common/s_lround.c: Add lround(), lroundf(), llround(), and
llroundf() documentation.
* libm/common/s_lrint.c: Add lrint(), lrintf(), llrint(), and llrintf()
documentation.
* libm/common/isgreater.c: New file for documenting math.h function-like
macros isgreater(), isgreaterequal(), isless(), islessequal(),
islessgreater(), and isunordered().
* libm/common/s_isnan.c: Add documentation for function-like macros
fpclassify(), isfinite(), isinf(), isnan(), and isnormal().
* libm/common/s_nearbyint.c: Add nearbyint() and nearbyintf()
documentation.
* libm/common/Makefile.am: Add s_llround.c (src); sf_llround.c (fsrc);
s_fdim.def, s_fma.def, s_fmax.def, s_fmin.def,
s_logb.def, s_lrint.def, s_lround.def, s_nearbyint.def, s_remquo.def,
s_rint.def, s_round.def, s_signbit.def, s_trunc.def, and
isgreater.def (chobj);
re-name all existing chew files (chobj) to match source file base
names (put in underscores), delete all special targets for chew files
(leaving all to be generated by rule).
* libm/common/Makefile.in: regenerate.
* libm/math/w_exp2.c: Add "base 2" to documentation description (and
delete TRAD_SYNOPSIS).
* libm/math/w_gamma.c: Add tgamma() and tgammaf() documentation, along
with some history behind the function names.
* libm/math/math.tex: Add includes for newly-added documentation (see
.def additions to common/Makefile.am and math/Makefile.am in this
ChangeLog list), adjusted existing .def file names to match source file
base names (added underscores); add mention of HUGE_VALF; rename
"Version of library" section to "Error Handling" and add some text
about floating-point exception; added section "Standards Compliance And
Portability".
* libm/math/Makefile.am: Add w_exp2.def (chobj);
re-name all existing chew files (chobj) to match source file base
names, delete all special targets for chew files (leaving all to be
generated by rule).
* libm/math/Makefile.in: regenerated
* doc/makedoc.c: Change silent ignoring of commands < 5 characters
to a failure when reading macro file for commands < 4 characters;
add -v (verbose) option for printing some debugging information;
get rid of spurious translation of "@*" to "*" (no source files used @*,
so no existing doc pages were affected); clean up some compiler
warnings.
* doc/doc.str: add BUGS and SEEALSO sections (to match texi2pod.pl
which has them); Remove ITEM command (redundant with makedoc built-in
"o", not used in any present source file so nothing is lost, anyway).
* HOWTO: New file to hold information for maintainers regarding how
to do things. Initial sections on documentation and ELIX levels.
2009-03-26 03:13:24 +08:00
|
|
|
extern long long int llroundf _PARAMS((float));
|
2002-06-08 05:59:57 +08:00
|
|
|
extern float truncf _PARAMS((float));
|
|
|
|
extern float remquof _PARAMS((float, float, int *));
|
|
|
|
extern float fdimf _PARAMS((float, float));
|
|
|
|
extern float fmaxf _PARAMS((float, float));
|
|
|
|
extern float fminf _PARAMS((float, float));
|
|
|
|
extern float fmaf _PARAMS((float, float, float));
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
extern float infinityf _PARAMS((void));
|
2003-07-10 01:52:31 +08:00
|
|
|
extern float nanf _PARAMS((const char *));
|
2000-02-18 03:39:52 +08:00
|
|
|
extern int finitef _PARAMS((float));
|
|
|
|
extern float copysignf _PARAMS((float, float));
|
2009-11-18 06:35:46 +08:00
|
|
|
extern float logbf _PARAMS((float));
|
2000-02-18 03:39:52 +08:00
|
|
|
extern int ilogbf _PARAMS((float));
|
|
|
|
|
|
|
|
extern float asinhf _PARAMS((float));
|
|
|
|
extern float cbrtf _PARAMS((float));
|
|
|
|
extern float nextafterf _PARAMS((float, float));
|
|
|
|
extern float rintf _PARAMS((float));
|
|
|
|
extern float scalbnf _PARAMS((float, int));
|
|
|
|
extern float log1pf _PARAMS((float));
|
|
|
|
extern float expm1f _PARAMS((float));
|
2007-05-18 02:50:57 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
extern float acoshf _PARAMS((float));
|
|
|
|
extern float atanhf _PARAMS((float));
|
|
|
|
extern float remainderf _PARAMS((float, float));
|
|
|
|
extern float gammaf _PARAMS((float));
|
|
|
|
extern float lgammaf _PARAMS((float));
|
|
|
|
extern float erff _PARAMS((float));
|
|
|
|
extern float erfcf _PARAMS((float));
|
2009-03-19 02:11:18 +08:00
|
|
|
extern float log2f _PARAMS((float));
|
2007-07-12 02:09:08 +08:00
|
|
|
extern float hypotf _PARAMS((float, float));
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
|
|
|
|
2009-04-25 06:49:55 +08:00
|
|
|
/* On platforms where long double equals double. */
|
|
|
|
#ifdef _LDBL_EQ_DBL
|
2009-04-16 Ken Werner <ken.werner@de.ibm.com>
* libm/libm.texinfo: Add long double function support chapter.
* libc/include/machine/ieeefp.h: Add _LDBL_EQ_DBL define.
* libc/include/stdlib.h: Include <machine/ieeefp.h>.
(strtold, wcstold): Declare.
* libc/stdlib/strtold.c: New File.
* libc/stdlib/wcstold.c: Likewise.
* libc/configure.in: Add long double check.
* libc/configure: Regenerate.
* libc/stdlib/Makefile.am: Add strtold.c and wcstold.c.
* libc/stdlib/Makefile.in: Regenerate.
* libc/include/math.h (atanl, cosl, sinl, tanl, tanhl): Declare.
(frexpl, modfl, ceill, fabsl, floorl, log1pl, expm1l, acosl): Ditto.
(asinl, atan2l, coshl, sinhl, expl, ldexpl, logl, log10l, powl): Ditto.
(sqrtl, fmodl, hypotl, copysignl, nanl, ilogbl, asinhl, cbrt): Ditto.
(nextafterl, rintl, scalbnl, exp2l, scalblnl, tgammal): Ditto.
(nearbyintl, lrintl, llrintl, roundl, lroundl, llround): Ditto.
(llroundl, truncl, remquol, fdiml, fmaxl, fminl, fmal, acoshl): Ditto.
(atanhl, remainderl, lgammal, erfl, erfcl): Ditto.
* libm/common/atanl.c: New File.
* libm/common/cosl.c: Likewise.
* libm/common/sinl.c: Likewise.
* libm/common/modfl.c: Likewise.
* libm/common/frexpl.c: Likewise.
* libm/common/tanhl.c: Likewise.
* libm/common/tanl.c: Likewise.
* libm/common/expm1l.c: Likewise.
* libm/common/log1pl.c: Likewise.
* libm/common/ceill.c: Likewise.
* libm/common/fabsl.c: Likewise.
* libm/common/floorl.c: Likewise.
* libm/common/acosl.c: Likewise.
* libm/common/asinl.c: Likewise.
* libm/common/atan2l.c: Likewise.
* libm/common/coshl.c: Likewise.
* libm/common/expl.c: Likewise.
* libm/common/fmodl.c: Likewise.
* libm/common/hypotl.c: Likewise.
* libm/common/ldexpl.c: Likewise.
* libm/common/log10l.c: Likewise.
* libm/common/logl.c: Likewise.
* libm/common/powl.c: Likewise.
* libm/common/sqrtl.c: Likewise.
* libm/common/copysignl.c: Likewise.
* libm/common/ilogbl.c: Likewise.
* libm/common/nanl.c: Likewise.
* libm/common/cbrtl.c: Likewise.
* libm/common/asinhl.c: Likewise.
* libm/common/nextafterl.c: Likewise.
* libm/common/rintl.c: Likewise.
* libm/common/scalbnl.c: Likewise.
* libm/common/exp2l.c: Likewise.
* libm/common/fdiml.c: Likewise.
* libm/common/fmal.c: Likewise.
* libm/common/fmaxl.c: Likewise.
* libm/common/fminl.c: Likewise.
* libm/common/lrintl.c: Likewise.
* libm/common/lroundl.c: Likewise.
* libm/common/nearbyintl.c: Likewise.
* libm/common/remquol.c: Likewise.
* libm/common/roundl.c: Likewise.
* libm/common/scalblnl.c: Likewise.
* libm/common/truncl.c: Likewise.
* libm/common/acoshl.c: Likewise.
* libm/common/atanhl.c: Likewise.
* libm/common/erfcl.c: Likewise.
* libm/common/erfl.c: Likewise.
* libm/common/lgammal.c: Likewise.
* libm/common/remainderl.c: Likewise.
* libm/common/tgammal.c: Likewise.
* libm/common/sinhl.c: Likewise.
* libm/common/llroundl.c: Likewise.
* libm/configure.in: Add long double check.
* libm/configure: Regenerate.
* libm/common/Makefile.am: Add new files.
* libm/common/Makefile.in: Regenerate.
2009-04-17 02:24:35 +08:00
|
|
|
/* Reentrant ANSI C functions. */
|
|
|
|
#ifndef __math_68881
|
|
|
|
extern long double atanl _PARAMS((long double));
|
|
|
|
extern long double cosl _PARAMS((long double));
|
|
|
|
extern long double sinl _PARAMS((long double));
|
|
|
|
extern long double tanl _PARAMS((long double));
|
|
|
|
extern long double tanhl _PARAMS((long double));
|
|
|
|
extern long double frexpl _PARAMS((long double value, int *));
|
|
|
|
extern long double modfl _PARAMS((long double, long double *));
|
|
|
|
extern long double ceill _PARAMS((long double));
|
|
|
|
extern long double fabsl _PARAMS((long double));
|
|
|
|
extern long double floorl _PARAMS((long double));
|
|
|
|
extern long double log1pl _PARAMS((long double));
|
|
|
|
extern long double expm1l _PARAMS((long double));
|
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
/* Non reentrant ANSI C functions. */
|
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
#ifndef __math_68881
|
|
|
|
extern long double acosl _PARAMS((long double));
|
|
|
|
extern long double asinl _PARAMS((long double));
|
|
|
|
extern long double atan2l _PARAMS((long double, long double));
|
|
|
|
extern long double coshl _PARAMS((long double));
|
|
|
|
extern long double sinhl _PARAMS((long double));
|
|
|
|
extern long double expl _PARAMS((long double));
|
|
|
|
extern long double ldexpl _PARAMS((long double, int));
|
|
|
|
extern long double logl _PARAMS((long double));
|
|
|
|
extern long double log10l _PARAMS((long double));
|
|
|
|
extern long double powl _PARAMS((long double, long double));
|
|
|
|
extern long double sqrtl _PARAMS((long double));
|
|
|
|
extern long double fmodl _PARAMS((long double, long double));
|
|
|
|
extern long double hypotl _PARAMS((long double, long double));
|
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
|
|
|
extern long double copysignl _PARAMS((long double, long double));
|
|
|
|
extern long double nanl _PARAMS((const char *));
|
|
|
|
extern int ilogbl _PARAMS((long double));
|
|
|
|
extern long double asinhl _PARAMS((long double));
|
|
|
|
extern long double cbrtl _PARAMS((long double));
|
|
|
|
extern long double nextafterl _PARAMS((long double, long double));
|
|
|
|
extern long double rintl _PARAMS((long double));
|
|
|
|
extern long double scalbnl _PARAMS((long double, int));
|
|
|
|
extern long double exp2l _PARAMS((long double));
|
|
|
|
extern long double scalblnl _PARAMS((long double, long));
|
|
|
|
extern long double tgammal _PARAMS((long double));
|
|
|
|
extern long double nearbyintl _PARAMS((long double));
|
|
|
|
extern long int lrintl _PARAMS((long double));
|
2009-04-18 04:54:19 +08:00
|
|
|
extern long long int llrintl _PARAMS((long double));
|
2009-04-16 Ken Werner <ken.werner@de.ibm.com>
* libm/libm.texinfo: Add long double function support chapter.
* libc/include/machine/ieeefp.h: Add _LDBL_EQ_DBL define.
* libc/include/stdlib.h: Include <machine/ieeefp.h>.
(strtold, wcstold): Declare.
* libc/stdlib/strtold.c: New File.
* libc/stdlib/wcstold.c: Likewise.
* libc/configure.in: Add long double check.
* libc/configure: Regenerate.
* libc/stdlib/Makefile.am: Add strtold.c and wcstold.c.
* libc/stdlib/Makefile.in: Regenerate.
* libc/include/math.h (atanl, cosl, sinl, tanl, tanhl): Declare.
(frexpl, modfl, ceill, fabsl, floorl, log1pl, expm1l, acosl): Ditto.
(asinl, atan2l, coshl, sinhl, expl, ldexpl, logl, log10l, powl): Ditto.
(sqrtl, fmodl, hypotl, copysignl, nanl, ilogbl, asinhl, cbrt): Ditto.
(nextafterl, rintl, scalbnl, exp2l, scalblnl, tgammal): Ditto.
(nearbyintl, lrintl, llrintl, roundl, lroundl, llround): Ditto.
(llroundl, truncl, remquol, fdiml, fmaxl, fminl, fmal, acoshl): Ditto.
(atanhl, remainderl, lgammal, erfl, erfcl): Ditto.
* libm/common/atanl.c: New File.
* libm/common/cosl.c: Likewise.
* libm/common/sinl.c: Likewise.
* libm/common/modfl.c: Likewise.
* libm/common/frexpl.c: Likewise.
* libm/common/tanhl.c: Likewise.
* libm/common/tanl.c: Likewise.
* libm/common/expm1l.c: Likewise.
* libm/common/log1pl.c: Likewise.
* libm/common/ceill.c: Likewise.
* libm/common/fabsl.c: Likewise.
* libm/common/floorl.c: Likewise.
* libm/common/acosl.c: Likewise.
* libm/common/asinl.c: Likewise.
* libm/common/atan2l.c: Likewise.
* libm/common/coshl.c: Likewise.
* libm/common/expl.c: Likewise.
* libm/common/fmodl.c: Likewise.
* libm/common/hypotl.c: Likewise.
* libm/common/ldexpl.c: Likewise.
* libm/common/log10l.c: Likewise.
* libm/common/logl.c: Likewise.
* libm/common/powl.c: Likewise.
* libm/common/sqrtl.c: Likewise.
* libm/common/copysignl.c: Likewise.
* libm/common/ilogbl.c: Likewise.
* libm/common/nanl.c: Likewise.
* libm/common/cbrtl.c: Likewise.
* libm/common/asinhl.c: Likewise.
* libm/common/nextafterl.c: Likewise.
* libm/common/rintl.c: Likewise.
* libm/common/scalbnl.c: Likewise.
* libm/common/exp2l.c: Likewise.
* libm/common/fdiml.c: Likewise.
* libm/common/fmal.c: Likewise.
* libm/common/fmaxl.c: Likewise.
* libm/common/fminl.c: Likewise.
* libm/common/lrintl.c: Likewise.
* libm/common/lroundl.c: Likewise.
* libm/common/nearbyintl.c: Likewise.
* libm/common/remquol.c: Likewise.
* libm/common/roundl.c: Likewise.
* libm/common/scalblnl.c: Likewise.
* libm/common/truncl.c: Likewise.
* libm/common/acoshl.c: Likewise.
* libm/common/atanhl.c: Likewise.
* libm/common/erfcl.c: Likewise.
* libm/common/erfl.c: Likewise.
* libm/common/lgammal.c: Likewise.
* libm/common/remainderl.c: Likewise.
* libm/common/tgammal.c: Likewise.
* libm/common/sinhl.c: Likewise.
* libm/common/llroundl.c: Likewise.
* libm/configure.in: Add long double check.
* libm/configure: Regenerate.
* libm/common/Makefile.am: Add new files.
* libm/common/Makefile.in: Regenerate.
2009-04-17 02:24:35 +08:00
|
|
|
extern long double roundl _PARAMS((long double));
|
|
|
|
extern long lroundl _PARAMS((long double));
|
|
|
|
extern _LONG_LONG_TYPE int llroundl _PARAMS((long double));
|
|
|
|
extern long double truncl _PARAMS((long double));
|
|
|
|
extern long double remquol _PARAMS((long double, long double, int *));
|
|
|
|
extern long double fdiml _PARAMS((long double, long double));
|
|
|
|
extern long double fmaxl _PARAMS((long double, long double));
|
|
|
|
extern long double fminl _PARAMS((long double, long double));
|
|
|
|
extern long double fmal _PARAMS((long double, long double, long double));
|
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
extern long double acoshl _PARAMS((long double));
|
|
|
|
extern long double atanhl _PARAMS((long double));
|
|
|
|
extern long double remainderl _PARAMS((long double, long double));
|
|
|
|
extern long double lgammal _PARAMS((long double));
|
|
|
|
extern long double erfl _PARAMS((long double));
|
|
|
|
extern long double erfcl _PARAMS((long double));
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
2009-04-25 06:49:55 +08:00
|
|
|
#else /* !_LDBL_EQ_DBL */
|
2009-04-04 01:42:27 +08:00
|
|
|
#ifdef __i386__
|
2009-04-16 Ken Werner <ken.werner@de.ibm.com>
* libm/libm.texinfo: Add long double function support chapter.
* libc/include/machine/ieeefp.h: Add _LDBL_EQ_DBL define.
* libc/include/stdlib.h: Include <machine/ieeefp.h>.
(strtold, wcstold): Declare.
* libc/stdlib/strtold.c: New File.
* libc/stdlib/wcstold.c: Likewise.
* libc/configure.in: Add long double check.
* libc/configure: Regenerate.
* libc/stdlib/Makefile.am: Add strtold.c and wcstold.c.
* libc/stdlib/Makefile.in: Regenerate.
* libc/include/math.h (atanl, cosl, sinl, tanl, tanhl): Declare.
(frexpl, modfl, ceill, fabsl, floorl, log1pl, expm1l, acosl): Ditto.
(asinl, atan2l, coshl, sinhl, expl, ldexpl, logl, log10l, powl): Ditto.
(sqrtl, fmodl, hypotl, copysignl, nanl, ilogbl, asinhl, cbrt): Ditto.
(nextafterl, rintl, scalbnl, exp2l, scalblnl, tgammal): Ditto.
(nearbyintl, lrintl, llrintl, roundl, lroundl, llround): Ditto.
(llroundl, truncl, remquol, fdiml, fmaxl, fminl, fmal, acoshl): Ditto.
(atanhl, remainderl, lgammal, erfl, erfcl): Ditto.
* libm/common/atanl.c: New File.
* libm/common/cosl.c: Likewise.
* libm/common/sinl.c: Likewise.
* libm/common/modfl.c: Likewise.
* libm/common/frexpl.c: Likewise.
* libm/common/tanhl.c: Likewise.
* libm/common/tanl.c: Likewise.
* libm/common/expm1l.c: Likewise.
* libm/common/log1pl.c: Likewise.
* libm/common/ceill.c: Likewise.
* libm/common/fabsl.c: Likewise.
* libm/common/floorl.c: Likewise.
* libm/common/acosl.c: Likewise.
* libm/common/asinl.c: Likewise.
* libm/common/atan2l.c: Likewise.
* libm/common/coshl.c: Likewise.
* libm/common/expl.c: Likewise.
* libm/common/fmodl.c: Likewise.
* libm/common/hypotl.c: Likewise.
* libm/common/ldexpl.c: Likewise.
* libm/common/log10l.c: Likewise.
* libm/common/logl.c: Likewise.
* libm/common/powl.c: Likewise.
* libm/common/sqrtl.c: Likewise.
* libm/common/copysignl.c: Likewise.
* libm/common/ilogbl.c: Likewise.
* libm/common/nanl.c: Likewise.
* libm/common/cbrtl.c: Likewise.
* libm/common/asinhl.c: Likewise.
* libm/common/nextafterl.c: Likewise.
* libm/common/rintl.c: Likewise.
* libm/common/scalbnl.c: Likewise.
* libm/common/exp2l.c: Likewise.
* libm/common/fdiml.c: Likewise.
* libm/common/fmal.c: Likewise.
* libm/common/fmaxl.c: Likewise.
* libm/common/fminl.c: Likewise.
* libm/common/lrintl.c: Likewise.
* libm/common/lroundl.c: Likewise.
* libm/common/nearbyintl.c: Likewise.
* libm/common/remquol.c: Likewise.
* libm/common/roundl.c: Likewise.
* libm/common/scalblnl.c: Likewise.
* libm/common/truncl.c: Likewise.
* libm/common/acoshl.c: Likewise.
* libm/common/atanhl.c: Likewise.
* libm/common/erfcl.c: Likewise.
* libm/common/erfl.c: Likewise.
* libm/common/lgammal.c: Likewise.
* libm/common/remainderl.c: Likewise.
* libm/common/tgammal.c: Likewise.
* libm/common/sinhl.c: Likewise.
* libm/common/llroundl.c: Likewise.
* libm/configure.in: Add long double check.
* libm/configure: Regenerate.
* libm/common/Makefile.am: Add new files.
* libm/common/Makefile.in: Regenerate.
2009-04-17 02:24:35 +08:00
|
|
|
/* Other long double precision functions. */
|
2007-12-19 Dave Korn <dave.korn@artimi.com>
Jeff Johnston <jjohnstn@redhhat.com>
* libc/include/_ansi.h: Add _LONG_LONG definition.
* libc/include/math.h (llrint, llrintf, rintl, lrintl, llrintl): Add
prototypes.
* libc/machine/i386/machine/fastmath.h: Add support for new i386
fast math versions of rint, lrint, and llrint family functions.
* libm/machine/i386/Makefile.am: Add new files.
* libm/machine/i386/Makefile.in: Regenerated.
* libm/machine/i386/f_llrint.c, libm/machine/i386/f_lrint.c,
libm/machine/i386/f_rint.c, libm/machine/i386/f_llrintf.c,
libm/machine/i386/f_lrintf.c, libm/machine/i386/f_rintf.c,
libm/machine/i386/f_llrintl.c, libm/machine/i386/f_lrintl.c,
libm/machine/i386/f_rintl.c: New files with fast math implementations.
2007-12-20 06:20:25 +08:00
|
|
|
extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE));
|
|
|
|
extern long int lrintl _PARAMS((_LONG_DOUBLE));
|
2008-04-24 07:10:54 +08:00
|
|
|
extern _LONG_LONG_TYPE llrintl _PARAMS((_LONG_DOUBLE));
|
2009-04-04 01:42:27 +08:00
|
|
|
#endif /* __i386__ */
|
2009-04-25 06:49:55 +08:00
|
|
|
#endif /* !_LDBL_EQ_DBL */
|
2007-12-19 Dave Korn <dave.korn@artimi.com>
Jeff Johnston <jjohnstn@redhhat.com>
* libc/include/_ansi.h: Add _LONG_LONG definition.
* libc/include/math.h (llrint, llrintf, rintl, lrintl, llrintl): Add
prototypes.
* libc/machine/i386/machine/fastmath.h: Add support for new i386
fast math versions of rint, lrint, and llrint family functions.
* libm/machine/i386/Makefile.am: Add new files.
* libm/machine/i386/Makefile.in: Regenerated.
* libm/machine/i386/f_llrint.c, libm/machine/i386/f_lrint.c,
libm/machine/i386/f_rint.c, libm/machine/i386/f_llrintf.c,
libm/machine/i386/f_lrintf.c, libm/machine/i386/f_rintf.c,
libm/machine/i386/f_llrintl.c, libm/machine/i386/f_lrintl.c,
libm/machine/i386/f_rintl.c: New files with fast math implementations.
2007-12-20 06:20:25 +08:00
|
|
|
|
2007-07-12 02:09:08 +08:00
|
|
|
#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) || __STDC_VERSION__ >= 199901L */
|
|
|
|
|
|
|
|
#if !defined (__STRICT_ANSI__) || defined(__cplusplus)
|
|
|
|
|
|
|
|
extern double drem _PARAMS((double, double));
|
|
|
|
extern void sincos _PARAMS((double, double *, double *));
|
|
|
|
extern double gamma_r _PARAMS((double, int *));
|
|
|
|
extern double lgamma_r _PARAMS((double, int *));
|
|
|
|
|
|
|
|
extern double y0 _PARAMS((double));
|
|
|
|
extern double y1 _PARAMS((double));
|
|
|
|
extern double yn _PARAMS((int, double));
|
|
|
|
extern double j0 _PARAMS((double));
|
|
|
|
extern double j1 _PARAMS((double));
|
|
|
|
extern double jn _PARAMS((int, double));
|
|
|
|
|
|
|
|
extern float dremf _PARAMS((float, float));
|
|
|
|
extern void sincosf _PARAMS((float, float *, float *));
|
|
|
|
extern float gammaf_r _PARAMS((float, int *));
|
|
|
|
extern float lgammaf_r _PARAMS((float, int *));
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
extern float y0f _PARAMS((float));
|
|
|
|
extern float y1f _PARAMS((float));
|
|
|
|
extern float ynf _PARAMS((int, float));
|
|
|
|
extern float j0f _PARAMS((float));
|
|
|
|
extern float j1f _PARAMS((float));
|
|
|
|
extern float jnf _PARAMS((int, float));
|
|
|
|
|
2007-07-12 02:09:08 +08:00
|
|
|
/* GNU extensions */
|
|
|
|
# ifndef exp10
|
|
|
|
extern double exp10 _PARAMS((double));
|
|
|
|
# endif
|
|
|
|
# ifndef pow10
|
|
|
|
extern double pow10 _PARAMS((double));
|
|
|
|
# endif
|
|
|
|
# ifndef exp10f
|
|
|
|
extern float exp10f _PARAMS((float));
|
|
|
|
# endif
|
|
|
|
# ifndef pow10f
|
|
|
|
extern float pow10f _PARAMS((float));
|
|
|
|
# endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2007-07-12 02:09:08 +08:00
|
|
|
#endif /* !defined (__STRICT_ANSI__) || defined(__cplusplus) */
|
|
|
|
|
|
|
|
#ifndef __STRICT_ANSI__
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
/* The gamma functions use a global variable, signgam. */
|
2001-01-30 06:40:50 +08:00
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
#define signgam (*__signgam())
|
|
|
|
extern int *__signgam _PARAMS((void));
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2002-02-03 17:24:18 +08:00
|
|
|
#define __signgam_r(ptr) _REENT_SIGNGAM(ptr)
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
/* The exception structure passed to the matherr routine. */
|
2006-10-26 02:46:40 +08:00
|
|
|
/* We have a problem when using C++ since `exception' is a reserved
|
|
|
|
name in C++. */
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __cplusplus
|
2007-05-17 03:59:40 +08:00
|
|
|
struct __exception
|
2000-02-18 03:39:52 +08:00
|
|
|
#else
|
2007-05-17 03:59:40 +08:00
|
|
|
struct exception
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
int type;
|
|
|
|
char *name;
|
|
|
|
double arg1;
|
|
|
|
double arg2;
|
|
|
|
double retval;
|
|
|
|
int err;
|
|
|
|
};
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern int matherr _PARAMS((struct __exception *e));
|
|
|
|
#else
|
|
|
|
extern int matherr _PARAMS((struct exception *e));
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* Values for the type field of struct exception. */
|
|
|
|
|
|
|
|
#define DOMAIN 1
|
|
|
|
#define SING 2
|
|
|
|
#define OVERFLOW 3
|
|
|
|
#define UNDERFLOW 4
|
|
|
|
#define TLOSS 5
|
|
|
|
#define PLOSS 6
|
|
|
|
|
|
|
|
/* Useful constants. */
|
|
|
|
|
2002-07-09 02:05:58 +08:00
|
|
|
#define MAXFLOAT 3.40282347e+38F
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#define M_E 2.7182818284590452354
|
2007-09-07 23:30:59 +08:00
|
|
|
#define M_LOG2E 1.4426950408889634074
|
2000-02-18 03:39:52 +08:00
|
|
|
#define M_LOG10E 0.43429448190325182765
|
2010-12-04 00:08:48 +08:00
|
|
|
#define M_LN2 _M_LN2
|
2000-02-18 03:39:52 +08:00
|
|
|
#define M_LN10 2.30258509299404568402
|
|
|
|
#define M_PI 3.14159265358979323846
|
|
|
|
#define M_TWOPI (M_PI * 2.0)
|
|
|
|
#define M_PI_2 1.57079632679489661923
|
|
|
|
#define M_PI_4 0.78539816339744830962
|
|
|
|
#define M_3PI_4 2.3561944901923448370E0
|
|
|
|
#define M_SQRTPI 1.77245385090551602792981
|
|
|
|
#define M_1_PI 0.31830988618379067154
|
|
|
|
#define M_2_PI 0.63661977236758134308
|
|
|
|
#define M_2_SQRTPI 1.12837916709551257390
|
|
|
|
#define M_SQRT2 1.41421356237309504880
|
|
|
|
#define M_SQRT1_2 0.70710678118654752440
|
|
|
|
#define M_LN2LO 1.9082149292705877000E-10
|
|
|
|
#define M_LN2HI 6.9314718036912381649E-1
|
2007-05-17 03:59:40 +08:00
|
|
|
#define M_SQRT3 1.73205080756887719000
|
2000-02-18 03:39:52 +08:00
|
|
|
#define M_IVLN10 0.43429448190325182765 /* 1 / log(10) */
|
2010-12-04 00:08:48 +08:00
|
|
|
#define M_LOG2_E _M_LN2
|
2000-02-18 03:39:52 +08:00
|
|
|
#define M_INVLN2 1.4426950408889633870E0 /* 1 / log(2) */
|
|
|
|
|
|
|
|
/* Global control over fdlibm error handling. */
|
|
|
|
|
|
|
|
enum __fdlibm_version
|
|
|
|
{
|
|
|
|
__fdlibm_ieee = -1,
|
|
|
|
__fdlibm_svid,
|
|
|
|
__fdlibm_xopen,
|
|
|
|
__fdlibm_posix
|
|
|
|
};
|
|
|
|
|
|
|
|
#define _LIB_VERSION_TYPE enum __fdlibm_version
|
|
|
|
#define _LIB_VERSION __fdlib_version
|
|
|
|
|
2006-09-14 06:06:43 +08:00
|
|
|
extern __IMPORT _LIB_VERSION_TYPE _LIB_VERSION;
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
#define _IEEE_ __fdlibm_ieee
|
|
|
|
#define _SVID_ __fdlibm_svid
|
|
|
|
#define _XOPEN_ __fdlibm_xopen
|
|
|
|
#define _POSIX_ __fdlibm_posix
|
|
|
|
|
|
|
|
#endif /* ! defined (__STRICT_ANSI__) */
|
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
_END_STD_C
|
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifdef __FAST_MATH__
|
|
|
|
#include <machine/fastmath.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _MATH_H_ */
|