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>
|
2016-03-15 05:26:18 +08:00
|
|
|
#include <sys/cdefs.h>
|
2000-02-18 03:39:52 +08:00
|
|
|
#include <machine/ieeefp.h>
|
|
|
|
#include "_ansi.h"
|
|
|
|
|
2002-06-28 07:58:38 +08:00
|
|
|
_BEGIN_STD_C
|
|
|
|
|
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
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double atan (double);
|
|
|
|
extern double cos (double);
|
|
|
|
extern double sin (double);
|
|
|
|
extern double tan (double);
|
|
|
|
extern double tanh (double);
|
|
|
|
extern double frexp (double, int *);
|
|
|
|
extern double modf (double, double *);
|
|
|
|
extern double ceil (double);
|
|
|
|
extern double fabs (double);
|
|
|
|
extern double floor (double);
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
|
|
|
|
/* Non reentrant ANSI C functions. */
|
|
|
|
|
|
|
|
#ifndef _REENT_ONLY
|
2009-04-04 01:42:27 +08:00
|
|
|
#ifndef __math_68881
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double acos (double);
|
|
|
|
extern double asin (double);
|
|
|
|
extern double atan2 (double, double);
|
|
|
|
extern double cosh (double);
|
|
|
|
extern double sinh (double);
|
|
|
|
extern double exp (double);
|
|
|
|
extern double ldexp (double, int);
|
|
|
|
extern double log (double);
|
|
|
|
extern double log10 (double);
|
|
|
|
extern double pow (double, double);
|
|
|
|
extern double sqrt (double);
|
|
|
|
extern double fmod (double, double);
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
|
|
|
|
2016-04-05 03:13:21 +08:00
|
|
|
#if __MISC_VISIBLE
|
2017-12-04 10:41:16 +08:00
|
|
|
extern int finite (double);
|
|
|
|
extern int finitef (float);
|
|
|
|
extern int finitel (long double);
|
|
|
|
extern int isinff (float);
|
|
|
|
extern int isnanf (float);
|
2016-04-05 03:13:21 +08:00
|
|
|
#ifdef __CYGWIN__ /* not implemented in newlib yet */
|
2017-12-04 10:41:16 +08:00
|
|
|
extern int isinfl (long double);
|
|
|
|
extern int isnanl (long double);
|
2016-04-05 03:13:21 +08:00
|
|
|
#endif
|
|
|
|
#if !defined(__cplusplus) || __cplusplus < 201103L
|
2017-12-04 10:41:16 +08:00
|
|
|
extern int isinf (double);
|
2016-04-05 03:13:21 +08:00
|
|
|
#endif
|
|
|
|
#endif /* __MISC_VISIBLE */
|
|
|
|
#if (__MISC_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 600)) \
|
|
|
|
&& (!defined(__cplusplus) || __cplusplus < 201103L)
|
2017-12-04 10:41:16 +08:00
|
|
|
extern int isnan (double);
|
2016-04-05 03:13:21 +08:00
|
|
|
#endif
|
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#if __ISO_C_VISIBLE >= 1999
|
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
|
2016-05-31 22:30:46 +08:00
|
|
|
# define FP_ILOGB0 (-__INT_MAX__)
|
2007-05-17 03:59:40 +08:00
|
|
|
#endif
|
|
|
|
#ifndef FP_ILOGBNAN
|
2016-05-31 22:30:46 +08:00
|
|
|
# define FP_ILOGBNAN __INT_MAX__
|
2007-05-17 03:59:40 +08:00
|
|
|
#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
|
|
|
|
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
|
2016-04-05 04:49:31 +08:00
|
|
|
* (prototypes for them are earlier in this header). */
|
2007-04-27 03:23:37 +08:00
|
|
|
|
2016-03-27 03:33:46 +08:00
|
|
|
#if __GNUC_PREREQ (4, 4)
|
|
|
|
#define fpclassify(__x) (__builtin_fpclassify (FP_NAN, FP_INFINITE, \
|
|
|
|
FP_NORMAL, FP_SUBNORMAL, \
|
|
|
|
FP_ZERO, __x))
|
|
|
|
#ifndef isfinite
|
|
|
|
#define isfinite(__x) (__builtin_isfinite (__x))
|
|
|
|
#endif
|
|
|
|
#ifndef isinf
|
|
|
|
#define isinf(__x) (__builtin_isinf_sign (__x))
|
|
|
|
#endif
|
|
|
|
#ifndef isnan
|
|
|
|
#define isnan(__x) (__builtin_isnan (__x))
|
|
|
|
#endif
|
|
|
|
#define isnormal(__x) (__builtin_isnormal (__x))
|
|
|
|
#else
|
|
|
|
#define fpclassify(__x) \
|
|
|
|
((sizeof(__x) == sizeof(float)) ? __fpclassifyf(__x) : \
|
|
|
|
__fpclassifyd(__x))
|
|
|
|
#ifndef isfinite
|
|
|
|
#define isfinite(__y) \
|
|
|
|
(__extension__ ({int __cy = fpclassify(__y); \
|
|
|
|
__cy != FP_INFINITE && __cy != FP_NAN;}))
|
|
|
|
#endif
|
|
|
|
#ifndef isinf
|
|
|
|
#define isinf(__x) (fpclassify(__x) == FP_INFINITE)
|
|
|
|
#endif
|
|
|
|
#ifndef isnan
|
|
|
|
#define isnan(__x) (fpclassify(__x) == FP_NAN)
|
|
|
|
#endif
|
|
|
|
#define isnormal(__x) (fpclassify(__x) == FP_NORMAL)
|
2007-04-27 03:23:37 +08:00
|
|
|
#endif
|
|
|
|
|
2016-03-27 03:33:46 +08:00
|
|
|
#if __GNUC_PREREQ (4, 0)
|
|
|
|
#if defined(_HAVE_LONG_DOUBLE)
|
|
|
|
#define signbit(__x) \
|
|
|
|
((sizeof(__x) == sizeof(float)) ? __builtin_signbitf(__x) : \
|
|
|
|
(sizeof(__x) == sizeof(double)) ? __builtin_signbit (__x) : \
|
|
|
|
__builtin_signbitl(__x))
|
|
|
|
#else
|
|
|
|
#define signbit(__x) \
|
|
|
|
((sizeof(__x) == sizeof(float)) ? __builtin_signbitf(__x) : \
|
|
|
|
__builtin_signbit (__x))
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define signbit(__x) \
|
|
|
|
((sizeof(__x) == sizeof(float)) ? __signbitf(__x) : \
|
|
|
|
__signbitd(__x))
|
|
|
|
#endif
|
2002-06-08 05:59:57 +08:00
|
|
|
|
2016-03-27 03:33:46 +08:00
|
|
|
#if __GNUC_PREREQ (2, 97)
|
|
|
|
#define isgreater(__x,__y) (__builtin_isgreater (__x, __y))
|
|
|
|
#define isgreaterequal(__x,__y) (__builtin_isgreaterequal (__x, __y))
|
|
|
|
#define isless(__x,__y) (__builtin_isless (__x, __y))
|
|
|
|
#define islessequal(__x,__y) (__builtin_islessequal (__x, __y))
|
|
|
|
#define islessgreater(__x,__y) (__builtin_islessgreater (__x, __y))
|
|
|
|
#define isunordered(__x,__y) (__builtin_isunordered (__x, __y))
|
|
|
|
#else
|
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;}))
|
2016-03-27 03:33:46 +08:00
|
|
|
#endif
|
2002-06-08 05:59:57 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
/* Non ANSI double precision functions. */
|
|
|
|
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double infinity (void);
|
|
|
|
extern double nan (const char *);
|
|
|
|
extern double copysign (double, double);
|
|
|
|
extern double logb (double);
|
|
|
|
extern int ilogb (double);
|
|
|
|
|
|
|
|
extern double asinh (double);
|
|
|
|
extern double cbrt (double);
|
|
|
|
extern double nextafter (double, double);
|
|
|
|
extern double rint (double);
|
|
|
|
extern double scalbn (double, int);
|
|
|
|
|
|
|
|
extern double exp2 (double);
|
|
|
|
extern double scalbln (double, long int);
|
|
|
|
extern double tgamma (double);
|
|
|
|
extern double nearbyint (double);
|
|
|
|
extern long int lrint (double);
|
|
|
|
extern long long int llrint (double);
|
|
|
|
extern double round (double);
|
|
|
|
extern long int lround (double);
|
|
|
|
extern long long int llround (double);
|
|
|
|
extern double trunc (double);
|
|
|
|
extern double remquo (double, double, int *);
|
|
|
|
extern double fdim (double, double);
|
|
|
|
extern double fmax (double, double);
|
|
|
|
extern double fmin (double, double);
|
|
|
|
extern double fma (double, double, double);
|
2007-05-18 02:50:57 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifndef __math_68881
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double log1p (double);
|
|
|
|
extern double expm1 (double);
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
|
|
|
|
#ifndef _REENT_ONLY
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double acosh (double);
|
|
|
|
extern double atanh (double);
|
|
|
|
extern double remainder (double, double);
|
|
|
|
extern double gamma (double);
|
|
|
|
extern double lgamma (double);
|
|
|
|
extern double erf (double);
|
|
|
|
extern double erfc (double);
|
|
|
|
extern double log2 (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
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double hypot (double, double);
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
|
|
|
|
|
|
|
/* Single precision versions of ANSI functions. */
|
|
|
|
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float atanf (float);
|
|
|
|
extern float cosf (float);
|
|
|
|
extern float sinf (float);
|
|
|
|
extern float tanf (float);
|
|
|
|
extern float tanhf (float);
|
|
|
|
extern float frexpf (float, int *);
|
|
|
|
extern float modff (float, float *);
|
|
|
|
extern float ceilf (float);
|
|
|
|
extern float fabsf (float);
|
|
|
|
extern float floorf (float);
|
2000-02-18 03:39:52 +08:00
|
|
|
|
|
|
|
#ifndef _REENT_ONLY
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float acosf (float);
|
|
|
|
extern float asinf (float);
|
|
|
|
extern float atan2f (float, float);
|
|
|
|
extern float coshf (float);
|
|
|
|
extern float sinhf (float);
|
|
|
|
extern float expf (float);
|
|
|
|
extern float ldexpf (float, int);
|
|
|
|
extern float logf (float);
|
|
|
|
extern float log10f (float);
|
|
|
|
extern float powf (float, float);
|
|
|
|
extern float sqrtf (float);
|
|
|
|
extern float fmodf (float, float);
|
2000-02-18 03:39:52 +08:00
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
|
|
|
|
|
|
|
/* Other single precision functions. */
|
|
|
|
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float exp2f (float);
|
|
|
|
extern float scalblnf (float, long int);
|
|
|
|
extern float tgammaf (float);
|
|
|
|
extern float nearbyintf (float);
|
|
|
|
extern long int lrintf (float);
|
|
|
|
extern long long int llrintf (float);
|
|
|
|
extern float roundf (float);
|
|
|
|
extern long int lroundf (float);
|
|
|
|
extern long long int llroundf (float);
|
|
|
|
extern float truncf (float);
|
|
|
|
extern float remquof (float, float, int *);
|
|
|
|
extern float fdimf (float, float);
|
|
|
|
extern float fmaxf (float, float);
|
|
|
|
extern float fminf (float, float);
|
|
|
|
extern float fmaf (float, float, float);
|
|
|
|
|
|
|
|
extern float infinityf (void);
|
|
|
|
extern float nanf (const char *);
|
|
|
|
extern float copysignf (float, float);
|
|
|
|
extern float logbf (float);
|
|
|
|
extern int ilogbf (float);
|
|
|
|
|
|
|
|
extern float asinhf (float);
|
|
|
|
extern float cbrtf (float);
|
|
|
|
extern float nextafterf (float, float);
|
|
|
|
extern float rintf (float);
|
|
|
|
extern float scalbnf (float, int);
|
|
|
|
extern float log1pf (float);
|
|
|
|
extern float expm1f (float);
|
2007-05-18 02:50:57 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
#ifndef _REENT_ONLY
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float acoshf (float);
|
|
|
|
extern float atanhf (float);
|
|
|
|
extern float remainderf (float, float);
|
|
|
|
extern float gammaf (float);
|
|
|
|
extern float lgammaf (float);
|
|
|
|
extern float erff (float);
|
|
|
|
extern float erfcf (float);
|
|
|
|
extern float log2f (float);
|
|
|
|
extern float hypotf (float, float);
|
2007-07-12 02:09:08 +08:00
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
|
|
|
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
/* Newlib doesn't fully support long double math functions so far.
|
|
|
|
On platforms where long double equals double the long double functions
|
|
|
|
simply call the double functions. On Cygwin the long double functions
|
|
|
|
are implemented independently from newlib to be able to use optimized
|
|
|
|
assembler functions despite using the Microsoft x86_64 ABI. */
|
|
|
|
#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
|
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
|
2017-12-04 10:41:16 +08:00
|
|
|
extern long double atanl (long double);
|
|
|
|
extern long double cosl (long double);
|
|
|
|
extern long double sinl (long double);
|
|
|
|
extern long double tanl (long double);
|
|
|
|
extern long double tanhl (long double);
|
|
|
|
extern long double frexpl (long double, int *);
|
|
|
|
extern long double modfl (long double, long double *);
|
|
|
|
extern long double ceill (long double);
|
|
|
|
extern long double fabsl (long double);
|
|
|
|
extern long double floorl (long double);
|
|
|
|
extern long double log1pl (long double);
|
|
|
|
extern long double expm1l (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
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
/* Non reentrant ANSI C functions. */
|
|
|
|
#ifndef _REENT_ONLY
|
|
|
|
#ifndef __math_68881
|
2017-12-04 10:41:16 +08:00
|
|
|
extern long double acosl (long double);
|
|
|
|
extern long double asinl (long double);
|
|
|
|
extern long double atan2l (long double, long double);
|
|
|
|
extern long double coshl (long double);
|
|
|
|
extern long double sinhl (long double);
|
|
|
|
extern long double expl (long double);
|
|
|
|
extern long double ldexpl (long double, int);
|
|
|
|
extern long double logl (long double);
|
|
|
|
extern long double log10l (long double);
|
|
|
|
extern long double powl (long double, long double);
|
|
|
|
extern long double sqrtl (long double);
|
|
|
|
extern long double fmodl (long double, long double);
|
|
|
|
extern long double hypotl (long double, 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
|
|
|
#endif /* ! defined (__math_68881) */
|
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
2017-12-04 10:41:16 +08:00
|
|
|
extern long double copysignl (long double, long double);
|
|
|
|
extern long double nanl (const char *);
|
|
|
|
extern int ilogbl (long double);
|
|
|
|
extern long double asinhl (long double);
|
|
|
|
extern long double cbrtl (long double);
|
|
|
|
extern long double nextafterl (long double, long double);
|
|
|
|
extern float nexttowardf (float, long double);
|
|
|
|
extern double nexttoward (double, long double);
|
|
|
|
extern long double nexttowardl (long double, long double);
|
|
|
|
extern long double logbl (long double);
|
|
|
|
extern long double log2l (long double);
|
|
|
|
extern long double rintl (long double);
|
|
|
|
extern long double scalbnl (long double, int);
|
|
|
|
extern long double exp2l (long double);
|
|
|
|
extern long double scalblnl (long double, long);
|
|
|
|
extern long double tgammal (long double);
|
|
|
|
extern long double nearbyintl (long double);
|
|
|
|
extern long int lrintl (long double);
|
|
|
|
extern long long int llrintl (long double);
|
|
|
|
extern long double roundl (long double);
|
|
|
|
extern long lroundl (long double);
|
|
|
|
extern long long int llroundl (long double);
|
|
|
|
extern long double truncl (long double);
|
|
|
|
extern long double remquol (long double, long double, int *);
|
|
|
|
extern long double fdiml (long double, long double);
|
|
|
|
extern long double fmaxl (long double, long double);
|
|
|
|
extern long double fminl (long double, long double);
|
|
|
|
extern long double fmal (long double, long double, 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
|
|
|
#ifndef _REENT_ONLY
|
2017-12-04 10:41:16 +08:00
|
|
|
extern long double acoshl (long double);
|
|
|
|
extern long double atanhl (long double);
|
|
|
|
extern long double remainderl (long double, long double);
|
|
|
|
extern long double lgammal (long double);
|
|
|
|
extern long double erfl (long double);
|
|
|
|
extern long double erfcl (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
|
|
|
#endif /* ! defined (_REENT_ONLY) */
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
#else /* !_LDBL_EQ_DBL && !__CYGWIN__ */
|
2017-12-04 10:41:16 +08:00
|
|
|
extern long double hypotl (long double, long double);
|
|
|
|
extern long double sqrtl (long double);
|
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. */
|
2017-12-04 10:41:16 +08:00
|
|
|
extern _LONG_DOUBLE rintl (_LONG_DOUBLE);
|
|
|
|
extern long int lrintl (_LONG_DOUBLE);
|
|
|
|
extern long long int llrintl (_LONG_DOUBLE);
|
2009-04-04 01:42:27 +08:00
|
|
|
#endif /* __i386__ */
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
#endif /* !_LDBL_EQ_DBL && !__CYGWIN__ */
|
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
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#endif /* __ISO_C_VISIBLE >= 1999 */
|
2007-07-12 02:09:08 +08:00
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#if __MISC_VISIBLE
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double drem (double, double);
|
|
|
|
extern float dremf (float, float);
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
#ifdef __CYGWIN__
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float dreml (long double, long double);
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
#endif /* __CYGWIN__ */
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double gamma_r (double, int *);
|
|
|
|
extern double lgamma_r (double, int *);
|
|
|
|
extern float gammaf_r (float, int *);
|
|
|
|
extern float lgammaf_r (float, int *);
|
2016-03-15 05:26:18 +08:00
|
|
|
#endif
|
2007-07-12 02:09:08 +08:00
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#if __MISC_VISIBLE || __XSI_VISIBLE
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double y0 (double);
|
|
|
|
extern double y1 (double);
|
|
|
|
extern double yn (int, double);
|
|
|
|
extern double j0 (double);
|
|
|
|
extern double j1 (double);
|
|
|
|
extern double jn (int, double);
|
2016-03-15 05:26:18 +08:00
|
|
|
#endif
|
2007-07-12 02:09:08 +08:00
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#if __MISC_VISIBLE || __XSI_VISIBLE >= 600
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float y0f (float);
|
|
|
|
extern float y1f (float);
|
|
|
|
extern float ynf (int, float);
|
|
|
|
extern float j0f (float);
|
|
|
|
extern float j1f (float);
|
|
|
|
extern float jnf (int, float);
|
2016-03-15 05:26:18 +08:00
|
|
|
#endif
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2007-07-12 02:09:08 +08:00
|
|
|
/* GNU extensions */
|
2016-03-15 05:26:18 +08:00
|
|
|
#if __GNU_VISIBLE
|
2017-12-04 10:41:16 +08:00
|
|
|
extern void sincos (double, double *, double *);
|
|
|
|
extern void sincosf (float, float *, float *);
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
#ifdef __CYGWIN__
|
2017-12-04 10:41:16 +08:00
|
|
|
extern void sincosl (long double, long double *, long double *);
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
#endif /* __CYGWIN__ */
|
2007-07-12 02:09:08 +08:00
|
|
|
# ifndef exp10
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double exp10 (double);
|
2007-07-12 02:09:08 +08:00
|
|
|
# endif
|
|
|
|
# ifndef pow10
|
2017-12-04 10:41:16 +08:00
|
|
|
extern double pow10 (double);
|
2007-07-12 02:09:08 +08:00
|
|
|
# endif
|
|
|
|
# ifndef exp10f
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float exp10f (float);
|
2007-07-12 02:09:08 +08:00
|
|
|
# endif
|
|
|
|
# ifndef pow10f
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float pow10f (float);
|
2007-07-12 02:09:08 +08:00
|
|
|
# endif
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
#ifdef __CYGWIN__
|
|
|
|
# ifndef exp10l
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float exp10l (float);
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
# endif
|
|
|
|
# ifndef pow10l
|
2017-12-04 10:41:16 +08:00
|
|
|
extern float pow10l (float);
|
Add missing long double functions to Cygwin
This patch adds the long double functions missing in newlib to Cygwin.
Apart from some self-written additions (exp10l, finite{f,l}, isinf{f,l},
isnan{f,l}, pow10l) the files are taken from the Mingw-w64 math lib.
Minor changes were required, e.g. substitue _WIN64 with __x86_64__ and
fixing __FLT_RPT_DOMAIN/__FLT_RPT_ERANGE for Cygwin.
Cygwin:
* math: New subdir with math functions.
* Makefile.in (VPATH): Add math subdir.
(MATH_OFILES): List of object files collected from building files in
math subdir.
(DLL_OFILES): Add $(MATH_OFILES).
${CURDIR}/libm.a: Add $(MATH_OFILES) to build.
* common.din: Add new functions from math subdir.
* i686.din: Align to new math subdir. Remove functions now commonly
available.
* x86_64.din: Ditto.
* math.h: math.h wrapper to define mingw structs used in some files in
math subdir.
* include/cygwin/version.h: Bump API minor version.
newlib:
* libc/include/complex.h: Add prototypes for complex long double
functions. Only define for Cygwin.
* libc/include/math.h: Additionally enable prototypes of long double
functions for Cygwin. Add Cygwin-only prototypes for dreml, sincosl,
exp10l and pow10l. Explain why we don't add them to newlib.
* libc/include/tgmath.h: Enable long double handling on Cygwin.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2016-03-29 01:35:20 +08:00
|
|
|
# endif
|
|
|
|
#endif /* __CYGWIN__ */
|
2016-03-15 05:26:18 +08:00
|
|
|
#endif /* __GNU_VISIBLE */
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#if __MISC_VISIBLE || __XSI_VISIBLE
|
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())
|
2017-12-04 10:41:16 +08:00
|
|
|
extern int *__signgam (void);
|
2001-01-30 06:40:50 +08:00
|
|
|
#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)
|
2016-03-15 05:26:18 +08:00
|
|
|
#endif /* __MISC_VISIBLE || __XSI_VISIBLE */
|
2000-02-18 03:39:52 +08:00
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#if __SVID_VISIBLE
|
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
|
2017-12-04 10:41:16 +08:00
|
|
|
extern int matherr (struct __exception *e);
|
2000-02-18 03:39:52 +08:00
|
|
|
#else
|
2017-12-04 10:41:16 +08:00
|
|
|
extern int matherr (struct exception *e);
|
2000-02-18 03:39:52 +08:00
|
|
|
#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
|
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#endif /* __SVID_VISIBLE */
|
2014-08-05 05:32:37 +08:00
|
|
|
|
2000-02-18 03:39:52 +08:00
|
|
|
/* Useful constants. */
|
|
|
|
|
2016-07-15 22:06:53 +08:00
|
|
|
#if __BSD_VISIBLE || __XSI_VISIBLE
|
2014-08-05 05:32:37 +08:00
|
|
|
|
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_PI_2 1.57079632679489661923
|
|
|
|
#define M_PI_4 0.78539816339744830962
|
|
|
|
#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
|
2014-08-05 05:32:37 +08:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#if __BSD_VISIBLE
|
2014-08-05 05:32:37 +08:00
|
|
|
|
|
|
|
#define M_TWOPI (M_PI * 2.0)
|
|
|
|
#define M_3PI_4 2.3561944901923448370E0
|
|
|
|
#define M_SQRTPI 1.77245385090551602792981
|
2000-02-18 03:39:52 +08:00
|
|
|
#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
|
|
|
|
|
2016-03-15 05:26:18 +08:00
|
|
|
#endif /* __BSD_VISIBLE */
|
2000-02-18 03:39:52 +08:00
|
|
|
|
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_ */
|