2024-01-22 17:01:50 +03:00
|
|
|
/* $NetBSD: math.h,v 1.69 2024/01/22 14:01:50 kre Exp $ */
|
1994-10-26 03:55:40 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1994-02-11 21:36:42 +03:00
|
|
|
* ====================================================
|
|
|
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
1993-03-21 12:45:37 +03:00
|
|
|
*
|
1994-02-11 21:36:42 +03:00
|
|
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
|
|
* Permission to use, copy, modify, and distribute this
|
2004-07-10 17:49:09 +04:00
|
|
|
* software is freely granted, provided that this notice
|
1994-02-11 21:36:42 +03:00
|
|
|
* is preserved.
|
|
|
|
* ====================================================
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
|
|
|
|
1994-02-11 21:36:42 +03:00
|
|
|
/*
|
1994-10-26 03:55:40 +03:00
|
|
|
* @(#)fdlibm.h 5.1 93/09/24
|
1994-02-11 21:36:42 +03:00
|
|
|
*/
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-02-11 21:36:42 +03:00
|
|
|
#ifndef _MATH_H_
|
1994-02-14 05:11:39 +03:00
|
|
|
#define _MATH_H_
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2000-01-04 17:20:05 +03:00
|
|
|
#include <sys/cdefs.h>
|
1998-05-07 22:50:08 +04:00
|
|
|
#include <sys/featuretest.h>
|
2002-02-19 16:08:12 +03:00
|
|
|
|
2020-02-23 01:47:35 +03:00
|
|
|
/*
|
|
|
|
* Missing for C99 support:
|
|
|
|
* - MATH_ERRNO
|
|
|
|
* - MATH_ERREXCEPT
|
|
|
|
* - FP_FAST_FMA
|
|
|
|
* - FP_FAST_FMAF
|
|
|
|
* - FP_FAST_FMAL
|
|
|
|
* - math_errhandling
|
|
|
|
*/
|
|
|
|
|
2002-02-19 16:08:12 +03:00
|
|
|
union __float_u {
|
|
|
|
unsigned char __dummy[sizeof(float)];
|
|
|
|
float __val;
|
|
|
|
};
|
|
|
|
|
|
|
|
union __double_u {
|
|
|
|
unsigned char __dummy[sizeof(double)];
|
|
|
|
double __val;
|
|
|
|
};
|
|
|
|
|
2003-05-18 00:42:28 +04:00
|
|
|
union __long_double_u {
|
|
|
|
unsigned char __dummy[sizeof(long double)];
|
|
|
|
long double __val;
|
|
|
|
};
|
|
|
|
|
|
|
|
#include <machine/math.h> /* may use __float_u, __double_u,
|
|
|
|
or __long_double_u */
|
2013-02-10 02:56:20 +04:00
|
|
|
#include <limits.h> /* for INT_{MIN,MAX} */
|
1998-05-07 22:50:08 +04:00
|
|
|
|
2020-02-23 01:47:35 +03:00
|
|
|
#if (!defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
|
|
|
|
!defined(_XOPEN_SOURCE)) || ((_POSIX_C_SOURCE - 0) >= 200809L || \
|
|
|
|
defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
|
|
|
|
(__cplusplus - 0) >= 201103L || defined(_NETBSD_SOURCE))
|
|
|
|
#define __MATH_C99_FEATURES
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __MATH_C99_FEATURES
|
2013-04-19 20:40:59 +04:00
|
|
|
# if defined(__FLT_EVAL_METHOD__) && (__FLT_EVAL_METHOD__ - 0) == 0
|
|
|
|
typedef double double_t;
|
|
|
|
typedef float float_t;
|
|
|
|
# elif (__FLT_EVAL_METHOD__ - 0) == 1
|
|
|
|
typedef double double_t;
|
|
|
|
typedef double float_t;
|
|
|
|
# elif (__FLT_EVAL_METHOD__ - 0) == 2
|
|
|
|
typedef long double double_t;
|
|
|
|
typedef long double float_t;
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2004-01-15 22:43:44 +03:00
|
|
|
#ifdef __HAVE_LONG_DOUBLE
|
|
|
|
#define __fpmacro_unary_floating(__name, __arg0) \
|
2004-03-04 03:17:44 +03:00
|
|
|
/* LINTED */ \
|
2004-01-15 22:43:44 +03:00
|
|
|
((sizeof (__arg0) == sizeof (float)) \
|
|
|
|
? __ ## __name ## f (__arg0) \
|
|
|
|
: (sizeof (__arg0) == sizeof (double)) \
|
|
|
|
? __ ## __name ## d (__arg0) \
|
|
|
|
: __ ## __name ## l (__arg0))
|
|
|
|
#else
|
|
|
|
#define __fpmacro_unary_floating(__name, __arg0) \
|
2004-03-04 03:17:44 +03:00
|
|
|
/* LINTED */ \
|
2004-01-15 22:43:44 +03:00
|
|
|
((sizeof (__arg0) == sizeof (float)) \
|
|
|
|
? __ ## __name ## f (__arg0) \
|
|
|
|
: __ ## __name ## d (__arg0))
|
2004-01-17 04:04:46 +03:00
|
|
|
#endif /* __HAVE_LONG_DOUBLE */
|
2004-01-15 22:43:44 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
/*
|
1994-02-11 21:36:42 +03:00
|
|
|
* ANSI/POSIX
|
1993-03-21 12:45:37 +03:00
|
|
|
*/
|
2003-10-26 03:02:02 +03:00
|
|
|
/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
|
2010-02-23 03:03:09 +03:00
|
|
|
#if __GNUC_PREREQ__(3, 3)
|
|
|
|
#define HUGE_VAL __builtin_huge_val()
|
|
|
|
#else
|
2005-12-24 22:12:23 +03:00
|
|
|
extern const union __double_u __infinity;
|
2002-02-19 16:08:12 +03:00
|
|
|
#define HUGE_VAL __infinity.__val
|
2010-02-23 03:03:09 +03:00
|
|
|
#endif
|
2002-02-19 16:08:12 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* ISO C99
|
|
|
|
*/
|
2020-02-23 01:47:35 +03:00
|
|
|
#if defined(__MATH_C99_FEATURES) || \
|
|
|
|
(_POSIX_C_SOURCE - 0) >= 200112L || (_XOPEN_SOURCE - 0) >= 600
|
2003-10-26 03:02:02 +03:00
|
|
|
/* 7.12#3 HUGE_VAL, HUGELF, HUGE_VALL */
|
2010-02-23 03:03:09 +03:00
|
|
|
#if __GNUC_PREREQ__(3, 3)
|
|
|
|
#define HUGE_VALF __builtin_huge_valf()
|
|
|
|
#define HUGE_VALL __builtin_huge_vall()
|
|
|
|
#else
|
2005-12-24 22:12:23 +03:00
|
|
|
extern const union __float_u __infinityf;
|
2003-10-26 02:35:46 +04:00
|
|
|
#define HUGE_VALF __infinityf.__val
|
|
|
|
|
2005-12-24 22:12:23 +03:00
|
|
|
extern const union __long_double_u __infinityl;
|
2003-10-26 02:35:46 +04:00
|
|
|
#define HUGE_VALL __infinityl.__val
|
2010-02-23 03:03:09 +03:00
|
|
|
#endif
|
2003-10-26 02:35:46 +04:00
|
|
|
|
2003-10-26 03:02:02 +03:00
|
|
|
/* 7.12#4 INFINITY */
|
2012-02-05 21:57:17 +04:00
|
|
|
#if defined(__INFINITY)
|
2003-10-26 03:02:02 +03:00
|
|
|
#define INFINITY __INFINITY /* float constant which overflows */
|
2012-02-05 21:57:17 +04:00
|
|
|
#elif __GNUC_PREREQ__(3, 3)
|
|
|
|
#define INFINITY __builtin_inff()
|
2003-10-26 03:02:02 +03:00
|
|
|
#else
|
|
|
|
#define INFINITY HUGE_VALF /* positive infinity */
|
|
|
|
#endif /* __INFINITY */
|
|
|
|
|
|
|
|
/* 7.12#5 NAN: a quiet NaN, if supported */
|
2003-10-26 02:35:46 +04:00
|
|
|
#ifdef __HAVE_NANF
|
2009-02-22 04:34:01 +03:00
|
|
|
#if __GNUC_PREREQ__(3,3)
|
|
|
|
#define NAN __builtin_nanf("")
|
|
|
|
#else
|
2005-12-24 22:12:23 +03:00
|
|
|
extern const union __float_u __nanf;
|
2002-02-19 16:08:12 +03:00
|
|
|
#define NAN __nanf.__val
|
2009-02-22 04:34:01 +03:00
|
|
|
#endif
|
2003-10-26 02:35:46 +04:00
|
|
|
#endif /* __HAVE_NANF */
|
2004-01-15 22:43:44 +03:00
|
|
|
|
|
|
|
/* 7.12#6 number classification macros */
|
|
|
|
#define FP_INFINITE 0x00
|
|
|
|
#define FP_NAN 0x01
|
|
|
|
#define FP_NORMAL 0x02
|
|
|
|
#define FP_SUBNORMAL 0x03
|
|
|
|
#define FP_ZERO 0x04
|
|
|
|
/* NetBSD extensions */
|
|
|
|
#define _FP_LOMD 0x80 /* range for machine-specific classes */
|
|
|
|
#define _FP_HIMD 0xff
|
|
|
|
|
2013-02-10 02:56:20 +04:00
|
|
|
#define FP_ILOGB0 INT_MIN
|
2013-02-11 11:29:21 +04:00
|
|
|
#define FP_ILOGBNAN INT_MAX
|
2013-02-10 02:56:20 +04:00
|
|
|
|
2020-02-23 01:47:35 +03:00
|
|
|
#endif /* C99 || _XOPEN_SOURCE >= 600 */
|
1993-03-21 12:45:37 +03:00
|
|
|
|
1994-02-11 21:36:42 +03:00
|
|
|
/*
|
|
|
|
* XOPEN/SVID
|
|
|
|
*/
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
1993-03-21 12:45:37 +03:00
|
|
|
#define M_E 2.7182818284590452354 /* e */
|
|
|
|
#define M_LOG2E 1.4426950408889634074 /* log 2e */
|
|
|
|
#define M_LOG10E 0.43429448190325182765 /* log 10e */
|
|
|
|
#define M_LN2 0.69314718055994530942 /* log e2 */
|
|
|
|
#define M_LN10 2.30258509299404568402 /* log e10 */
|
|
|
|
#define M_PI 3.14159265358979323846 /* pi */
|
|
|
|
#define M_PI_2 1.57079632679489661923 /* pi/2 */
|
|
|
|
#define M_PI_4 0.78539816339744830962 /* pi/4 */
|
|
|
|
#define M_1_PI 0.31830988618379067154 /* 1/pi */
|
|
|
|
#define M_2_PI 0.63661977236758134308 /* 2/pi */
|
|
|
|
#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
|
|
|
|
#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
|
|
|
|
#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
|
|
|
|
|
1994-02-11 21:36:42 +03:00
|
|
|
#define MAXFLOAT ((float)3.40282346638528860e+38)
|
|
|
|
extern int signgam;
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
|
1994-02-11 21:36:42 +03:00
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_NETBSD_SOURCE)
|
1994-02-11 21:36:42 +03:00
|
|
|
enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
|
|
|
|
|
|
|
|
#define _LIB_VERSION_TYPE enum fdversion
|
2004-07-10 17:49:09 +04:00
|
|
|
#define _LIB_VERSION _fdlib_version
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2004-07-10 17:49:09 +04:00
|
|
|
/* if global variable _LIB_VERSION is not desirable, one may
|
|
|
|
* change the following to be a constant by:
|
1994-02-11 21:36:42 +03:00
|
|
|
* #define _LIB_VERSION_TYPE const enum version
|
|
|
|
* In that case, after one initializes the value _LIB_VERSION (see
|
|
|
|
* s_lib_version.c) during compile time, it cannot be modified
|
|
|
|
* in the middle of a program
|
2004-07-10 17:49:09 +04:00
|
|
|
*/
|
1994-02-11 21:36:42 +03:00
|
|
|
extern _LIB_VERSION_TYPE _LIB_VERSION;
|
|
|
|
|
|
|
|
#define _IEEE_ fdlibm_ieee
|
|
|
|
#define _SVID_ fdlibm_svid
|
|
|
|
#define _XOPEN_ fdlibm_xopen
|
|
|
|
#define _POSIX_ fdlibm_posix
|
|
|
|
|
1998-04-09 03:42:59 +04:00
|
|
|
#ifndef __cplusplus
|
1994-02-11 21:36:42 +03:00
|
|
|
struct exception {
|
|
|
|
int type;
|
2008-04-26 01:20:57 +04:00
|
|
|
const char *name;
|
1994-02-11 21:36:42 +03:00
|
|
|
double arg1;
|
|
|
|
double arg2;
|
|
|
|
double retval;
|
|
|
|
};
|
1998-04-09 03:42:59 +04:00
|
|
|
#endif
|
1994-02-11 21:36:42 +03:00
|
|
|
|
|
|
|
#define HUGE MAXFLOAT
|
|
|
|
|
2004-07-10 17:49:09 +04:00
|
|
|
/*
|
1994-02-11 21:36:42 +03:00
|
|
|
* set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
|
|
|
|
* (one may replace the following line by "#include <values.h>")
|
|
|
|
*/
|
|
|
|
|
2004-07-10 17:49:09 +04:00
|
|
|
#define X_TLOSS 1.41484755040568800000e+16
|
1994-02-11 21:36:42 +03:00
|
|
|
|
|
|
|
#define DOMAIN 1
|
|
|
|
#define SING 2
|
|
|
|
#define OVERFLOW 3
|
|
|
|
#define UNDERFLOW 4
|
|
|
|
#define TLOSS 5
|
|
|
|
#define PLOSS 6
|
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#endif /* _NETBSD_SOURCE */
|
1994-02-11 21:36:42 +03:00
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
__BEGIN_DECLS
|
1994-02-11 21:36:42 +03:00
|
|
|
/*
|
|
|
|
* ANSI/POSIX
|
|
|
|
*/
|
2005-02-03 07:39:32 +03:00
|
|
|
double acos(double);
|
|
|
|
double asin(double);
|
|
|
|
double atan(double);
|
|
|
|
double atan2(double, double);
|
|
|
|
double cos(double);
|
|
|
|
double sin(double);
|
|
|
|
double tan(double);
|
|
|
|
|
|
|
|
double cosh(double);
|
|
|
|
double sinh(double);
|
|
|
|
double tanh(double);
|
|
|
|
|
|
|
|
double exp(double);
|
2010-01-11 19:28:39 +03:00
|
|
|
double exp2(double);
|
2005-02-03 07:39:32 +03:00
|
|
|
double frexp(double, int *);
|
|
|
|
double ldexp(double, int);
|
|
|
|
double log(double);
|
2005-07-21 16:56:29 +04:00
|
|
|
double log2(double);
|
2005-02-03 07:39:32 +03:00
|
|
|
double log10(double);
|
|
|
|
double modf(double, double *);
|
|
|
|
|
|
|
|
double pow(double, double);
|
|
|
|
double sqrt(double);
|
|
|
|
|
|
|
|
double ceil(double);
|
|
|
|
double fabs(double);
|
|
|
|
double floor(double);
|
|
|
|
double fmod(double, double);
|
1993-03-21 12:45:37 +03:00
|
|
|
|
2020-02-23 01:47:35 +03:00
|
|
|
#if defined(__MATH_C99_FEATURES) || defined(_XOPEN_SOURCE)
|
2005-02-03 07:39:32 +03:00
|
|
|
double erf(double);
|
|
|
|
double erfc(double);
|
|
|
|
double hypot(double, double);
|
2020-02-23 01:47:35 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
|
2005-02-03 07:39:32 +03:00
|
|
|
int finite(double);
|
2020-02-23 01:47:35 +03:00
|
|
|
double gamma(double);
|
2005-02-03 07:39:32 +03:00
|
|
|
double j0(double);
|
|
|
|
double j1(double);
|
|
|
|
double jn(int, double);
|
|
|
|
double y0(double);
|
|
|
|
double y1(double);
|
|
|
|
double yn(int, double);
|
1994-02-11 21:36:42 +03:00
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)
|
2018-06-25 02:55:29 +03:00
|
|
|
double scalb(double, double);
|
|
|
|
#endif /* (_XOPEN_SOURCE - 0) >= 500 || defined(_NETBSD_SOURCE)*/
|
|
|
|
#endif /* _XOPEN_SOURCE || _NETBSD_SOURCE */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ISO C99
|
|
|
|
*/
|
2020-02-23 01:47:35 +03:00
|
|
|
#if defined(__MATH_C99_FEATURES) || (_XOPEN_SOURCE - 0) >= 500
|
2005-02-03 07:39:32 +03:00
|
|
|
double acosh(double);
|
|
|
|
double asinh(double);
|
|
|
|
double atanh(double);
|
|
|
|
double cbrt(double);
|
|
|
|
double expm1(double);
|
|
|
|
int ilogb(double);
|
|
|
|
double log1p(double);
|
|
|
|
double logb(double);
|
|
|
|
double nextafter(double, double);
|
|
|
|
double remainder(double, double);
|
2018-06-25 02:55:29 +03:00
|
|
|
double rint(double);
|
|
|
|
#endif
|
1994-02-11 21:36:42 +03:00
|
|
|
|
2020-02-23 01:47:35 +03:00
|
|
|
#if defined(__MATH_C99_FEATURES) || (_XOPEN_SOURCE - 0) >= 600 || \
|
|
|
|
(_POSIX_C_SOURCE - 0) >= 200112L
|
2004-01-15 22:43:44 +03:00
|
|
|
/* 7.12.3.1 int fpclassify(real-floating x) */
|
|
|
|
#define fpclassify(__x) __fpmacro_unary_floating(fpclassify, __x)
|
|
|
|
|
|
|
|
/* 7.12.3.2 int isfinite(real-floating x) */
|
|
|
|
#define isfinite(__x) __fpmacro_unary_floating(isfinite, __x)
|
|
|
|
|
|
|
|
/* 7.12.3.5 int isnormal(real-floating x) */
|
|
|
|
#define isnormal(__x) (fpclassify(__x) == FP_NORMAL)
|
|
|
|
|
|
|
|
/* 7.12.3.6 int signbit(real-floating x) */
|
|
|
|
#define signbit(__x) __fpmacro_unary_floating(signbit, __x)
|
|
|
|
|
2004-06-30 19:11:05 +04:00
|
|
|
/* 7.12.4 trigonometric */
|
|
|
|
|
2005-02-03 07:39:32 +03:00
|
|
|
float acosf(float);
|
|
|
|
float asinf(float);
|
|
|
|
float atanf(float);
|
|
|
|
float atan2f(float, float);
|
|
|
|
float cosf(float);
|
|
|
|
float sinf(float);
|
|
|
|
float tanf(float);
|
2004-06-30 19:11:05 +04:00
|
|
|
|
2013-01-29 03:19:28 +04:00
|
|
|
long double acosl(long double);
|
|
|
|
long double asinl(long double);
|
|
|
|
long double atanl(long double);
|
|
|
|
long double atan2l(long double, long double);
|
|
|
|
long double cosl(long double);
|
|
|
|
long double sinl(long double);
|
|
|
|
long double tanl(long double);
|
|
|
|
|
2004-06-30 19:11:05 +04:00
|
|
|
/* 7.12.5 hyperbolic */
|
|
|
|
|
2005-02-03 07:39:32 +03:00
|
|
|
float acoshf(float);
|
|
|
|
float asinhf(float);
|
|
|
|
float atanhf(float);
|
|
|
|
float coshf(float);
|
|
|
|
float sinhf(float);
|
|
|
|
float tanhf(float);
|
2013-01-29 03:19:28 +04:00
|
|
|
long double acoshl(long double);
|
|
|
|
long double asinhl(long double);
|
|
|
|
long double atanhl(long double);
|
|
|
|
long double coshl(long double);
|
|
|
|
long double sinhl(long double);
|
|
|
|
long double tanhl(long double);
|
2004-06-30 19:11:05 +04:00
|
|
|
|
|
|
|
/* 7.12.6 exp / log */
|
2020-02-23 01:47:35 +03:00
|
|
|
double scalbn(double, int);
|
|
|
|
double scalbln(double, long);
|
2004-06-30 19:11:05 +04:00
|
|
|
|
2005-02-03 07:39:32 +03:00
|
|
|
float expf(float);
|
2010-01-11 19:28:39 +03:00
|
|
|
float exp2f(float);
|
2005-02-03 07:39:32 +03:00
|
|
|
float expm1f(float);
|
|
|
|
float frexpf(float, int *);
|
|
|
|
int ilogbf(float);
|
|
|
|
float ldexpf(float, int);
|
|
|
|
float logf(float);
|
2005-07-21 16:56:29 +04:00
|
|
|
float log2f(float);
|
2005-02-03 07:39:32 +03:00
|
|
|
float log10f(float);
|
|
|
|
float log1pf(float);
|
|
|
|
float logbf(float);
|
|
|
|
float modff(float, float *);
|
|
|
|
float scalbnf(float, int);
|
2013-01-29 03:19:28 +04:00
|
|
|
float scalblnf(float, long);
|
|
|
|
|
|
|
|
long double expl(long double);
|
|
|
|
long double exp2l(long double);
|
|
|
|
long double expm1l(long double);
|
|
|
|
long double frexpl(long double, int *);
|
|
|
|
int ilogbl(long double);
|
|
|
|
long double ldexpl(long double, int);
|
|
|
|
long double logl(long double);
|
|
|
|
long double log2l(long double);
|
|
|
|
long double log10l(long double);
|
|
|
|
long double log1pl(long double);
|
|
|
|
long double logbl(long double);
|
|
|
|
long double modfl(long double, long double *);
|
|
|
|
long double scalbnl(long double, int);
|
|
|
|
long double scalblnl(long double, long);
|
|
|
|
|
2004-06-30 19:11:05 +04:00
|
|
|
|
|
|
|
/* 7.12.7 power / absolute */
|
|
|
|
|
2005-02-03 07:39:32 +03:00
|
|
|
float cbrtf(float);
|
|
|
|
float fabsf(float);
|
|
|
|
float hypotf(float, float);
|
|
|
|
float powf(float, float);
|
|
|
|
float sqrtf(float);
|
2013-01-29 03:19:28 +04:00
|
|
|
long double cbrtl(long double);
|
|
|
|
long double fabsl(long double);
|
|
|
|
long double hypotl(long double, long double);
|
|
|
|
long double powl(long double, long double);
|
|
|
|
long double sqrtl(long double);
|
2004-06-30 19:11:05 +04:00
|
|
|
|
|
|
|
/* 7.12.8 error / gamma */
|
|
|
|
|
2020-02-23 01:47:35 +03:00
|
|
|
double lgamma(double);
|
2013-01-29 03:19:28 +04:00
|
|
|
double tgamma(double);
|
2005-02-03 07:39:32 +03:00
|
|
|
float erff(float);
|
|
|
|
float erfcf(float);
|
|
|
|
float lgammaf(float);
|
2012-05-06 02:07:57 +04:00
|
|
|
float tgammaf(float);
|
2013-01-29 03:19:28 +04:00
|
|
|
long double erfl(long double);
|
|
|
|
long double erfcl(long double);
|
|
|
|
long double lgammal(long double);
|
|
|
|
long double tgammal(long double);
|
2004-06-30 19:11:05 +04:00
|
|
|
|
|
|
|
/* 7.12.9 nearest integer */
|
2018-06-25 02:55:29 +03:00
|
|
|
|
2004-06-30 21:51:09 +04:00
|
|
|
/* LONGLONG */
|
2005-02-03 07:39:32 +03:00
|
|
|
long long int llrint(double);
|
|
|
|
long int lround(double);
|
2004-07-01 20:09:21 +04:00
|
|
|
/* LONGLONG */
|
2005-02-03 07:39:32 +03:00
|
|
|
long long int llround(double);
|
2013-01-29 03:19:28 +04:00
|
|
|
long int lrint(double);
|
|
|
|
double round(double);
|
|
|
|
double trunc(double);
|
|
|
|
|
|
|
|
float ceilf(float);
|
|
|
|
float floorf(float);
|
|
|
|
/* LONGLONG */
|
|
|
|
long long int llrintf(float);
|
|
|
|
long int lroundf(float);
|
2004-07-01 20:09:21 +04:00
|
|
|
/* LONGLONG */
|
2005-02-03 07:39:32 +03:00
|
|
|
long long int llroundf(float);
|
2013-01-29 03:19:28 +04:00
|
|
|
long int lrintf(float);
|
|
|
|
float rintf(float);
|
|
|
|
float roundf(float);
|
|
|
|
float truncf(float);
|
|
|
|
long double ceill(long double);
|
|
|
|
long double floorl(long double);
|
|
|
|
/* LONGLONG */
|
|
|
|
long long int llrintl(long double);
|
|
|
|
long int lroundl(long double);
|
|
|
|
/* LONGLONG */
|
|
|
|
long long int llroundl(long double);
|
|
|
|
long int lrintl(long double);
|
|
|
|
long double rintl(long double);
|
|
|
|
long double roundl(long double);
|
|
|
|
long double truncl(long double);
|
2004-06-30 19:11:05 +04:00
|
|
|
|
|
|
|
/* 7.12.10 remainder */
|
|
|
|
|
2005-02-03 07:39:32 +03:00
|
|
|
float fmodf(float, float);
|
|
|
|
float remainderf(float, float);
|
2013-01-29 03:19:28 +04:00
|
|
|
long double fmodl(long double, long double);
|
|
|
|
long double remainderl(long double, long double);
|
2004-06-30 19:11:05 +04:00
|
|
|
|
2011-02-06 03:44:08 +03:00
|
|
|
/* 7.12.10.3 The remquo functions */
|
|
|
|
double remquo(double, double, int *);
|
|
|
|
float remquof(float, float, int *);
|
2013-01-29 03:19:28 +04:00
|
|
|
long double remquol(long double, long double, int *);
|
2011-02-06 03:44:08 +03:00
|
|
|
|
2007-02-06 20:29:37 +03:00
|
|
|
/* 7.12.11 manipulation */
|
2004-06-30 19:11:05 +04:00
|
|
|
|
2020-02-23 01:47:35 +03:00
|
|
|
double copysign(double, double);
|
2006-03-23 19:55:42 +03:00
|
|
|
double nan(const char *);
|
2013-01-29 03:19:28 +04:00
|
|
|
double nearbyint(double);
|
|
|
|
double nexttoward(double, long double);
|
|
|
|
float copysignf(float, float);
|
2006-03-23 19:55:42 +03:00
|
|
|
float nanf(const char *);
|
2013-01-29 03:19:28 +04:00
|
|
|
float nearbyintf(float);
|
2005-02-03 07:39:32 +03:00
|
|
|
float nextafterf(float, float);
|
2013-01-29 03:19:28 +04:00
|
|
|
float nexttowardf(float, long double);
|
|
|
|
long double copysignl(long double, long double);
|
|
|
|
long double nanl(const char *);
|
|
|
|
long double nearbyintl(long double);
|
2010-09-15 20:11:28 +04:00
|
|
|
long double nextafterl(long double, long double);
|
2013-01-29 03:19:28 +04:00
|
|
|
long double nexttowardl(long double, long double);
|
2004-06-30 19:11:05 +04:00
|
|
|
|
2010-05-02 10:31:48 +04:00
|
|
|
/* 7.12.14 comparison */
|
2007-02-06 20:29:37 +03:00
|
|
|
|
|
|
|
#define isunordered(x, y) (isnan(x) || isnan(y))
|
|
|
|
#define isgreater(x, y) (!isunordered((x), (y)) && (x) > (y))
|
|
|
|
#define isgreaterequal(x, y) (!isunordered((x), (y)) && (x) >= (y))
|
|
|
|
#define isless(x, y) (!isunordered((x), (y)) && (x) < (y))
|
|
|
|
#define islessequal(x, y) (!isunordered((x), (y)) && (x) <= (y))
|
|
|
|
#define islessgreater(x, y) (!isunordered((x), (y)) && \
|
|
|
|
((x) > (y) || (y) > (x)))
|
2009-10-05 02:59:25 +04:00
|
|
|
double fdim(double, double);
|
2013-01-29 03:19:28 +04:00
|
|
|
double fma(double, double, double);
|
2009-10-05 02:59:25 +04:00
|
|
|
double fmax(double, double);
|
|
|
|
double fmin(double, double);
|
|
|
|
float fdimf(float, float);
|
2013-01-29 03:19:28 +04:00
|
|
|
float fmaf(float, float, float);
|
2009-10-05 02:59:25 +04:00
|
|
|
float fmaxf(float, float);
|
|
|
|
float fminf(float, float);
|
|
|
|
long double fdiml(long double, long double);
|
2013-01-29 03:19:28 +04:00
|
|
|
long double fmal(long double, long double, long double);
|
2009-10-05 02:59:25 +04:00
|
|
|
long double fmaxl(long double, long double);
|
|
|
|
long double fminl(long double, long double);
|
2004-06-30 19:11:05 +04:00
|
|
|
|
2004-01-15 22:43:44 +03:00
|
|
|
#endif /* !_ANSI_SOURCE && ... */
|
|
|
|
|
2020-02-23 01:47:35 +03:00
|
|
|
#if defined(__MATH_C99_FEATURES) || (_POSIX_C_SOURCE - 0) >= 200112L
|
2004-03-05 02:42:38 +03:00
|
|
|
/* 7.12.3.3 int isinf(real-floating x) */
|
2013-09-16 19:54:42 +04:00
|
|
|
#if defined(__isinf) || defined(__HAVE_INLINE___ISINF)
|
2004-03-05 02:42:38 +03:00
|
|
|
#define isinf(__x) __isinf(__x)
|
|
|
|
#else
|
|
|
|
#define isinf(__x) __fpmacro_unary_floating(isinf, __x)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* 7.12.3.4 int isnan(real-floating x) */
|
2013-09-16 19:54:42 +04:00
|
|
|
#if defined(__isnan) || defined(__HAVE_INLINE___ISNAN)
|
2004-03-05 02:42:38 +03:00
|
|
|
#define isnan(__x) __isnan(__x)
|
|
|
|
#else
|
|
|
|
#define isnan(__x) __fpmacro_unary_floating(isnan, __x)
|
|
|
|
#endif
|
|
|
|
#endif /* !_ANSI_SOURCE && ... */
|
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_NETBSD_SOURCE)
|
1998-04-09 03:42:59 +04:00
|
|
|
#ifndef __cplusplus
|
2005-02-03 07:39:32 +03:00
|
|
|
int matherr(struct exception *);
|
1998-04-09 03:42:59 +04:00
|
|
|
#endif
|
1994-02-11 21:36:42 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* IEEE Test Vector
|
|
|
|
*/
|
2005-02-03 07:39:32 +03:00
|
|
|
double significand(double);
|
1994-02-11 21:36:42 +03:00
|
|
|
|
|
|
|
/*
|
|
|
|
* BSD math library entry points
|
|
|
|
*/
|
2005-02-03 07:39:32 +03:00
|
|
|
double drem(double, double);
|
1994-02-11 21:36:42 +03:00
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#endif /* _NETBSD_SOURCE */
|
1998-05-07 22:50:08 +04:00
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)
|
1994-02-11 21:36:42 +03:00
|
|
|
/*
|
|
|
|
* Reentrant version of gamma & lgamma; passes signgam back by reference
|
|
|
|
* as the second argument; user must allocate space for signgam.
|
|
|
|
*/
|
2005-02-03 07:39:32 +03:00
|
|
|
double gamma_r(double, int *);
|
|
|
|
double lgamma_r(double, int *);
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#endif /* _NETBSD_SOURCE || _REENTRANT */
|
1994-08-11 00:48:16 +04:00
|
|
|
|
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_NETBSD_SOURCE)
|
1998-09-07 19:00:05 +04:00
|
|
|
|
1994-08-11 00:48:16 +04:00
|
|
|
/* float versions of ANSI/POSIX functions */
|
2000-06-13 05:21:52 +04:00
|
|
|
|
2005-02-03 07:39:32 +03:00
|
|
|
float gammaf(float);
|
|
|
|
int isinff(float);
|
|
|
|
int isnanf(float);
|
|
|
|
int finitef(float);
|
|
|
|
float j0f(float);
|
|
|
|
float j1f(float);
|
|
|
|
float jnf(int, float);
|
|
|
|
float y0f(float);
|
|
|
|
float y1f(float);
|
|
|
|
float ynf(int, float);
|
2000-06-13 05:21:52 +04:00
|
|
|
|
2005-02-03 07:39:32 +03:00
|
|
|
float scalbf(float, float);
|
1994-08-11 00:48:16 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* float version of IEEE Test Vector
|
|
|
|
*/
|
2005-02-03 07:39:32 +03:00
|
|
|
float significandf(float);
|
1994-08-11 00:48:16 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* float versions of BSD math library entry points
|
|
|
|
*/
|
2005-02-03 07:39:32 +03:00
|
|
|
float dremf(float, float);
|
2022-08-27 11:31:58 +03:00
|
|
|
|
|
|
|
void sincos(double, double *, double *);
|
|
|
|
void sincosf(float, float *, float *);
|
|
|
|
void sincosl(long double, long double *, long double *);
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#endif /* _NETBSD_SOURCE */
|
1994-08-11 00:48:16 +04:00
|
|
|
|
Add a new feature-test macro, _NETBSD_SOURCE. If this is defined
by the application, all NetBSD interfaces are made visible, even
if some other feature-test macro (like _POSIX_C_SOURCE) is defined.
<sys/featuretest.h> defined _NETBSD_SOURCE if none of _ANSI_SOURCE,
_POSIX_C_SOURCE and _XOPEN_SOURCE is defined, so as to preserve
existing behaviour.
This has two major advantages:
+ Programs that require non-POSIX facilities but define _POSIX_C_SOURCE
can trivially be overruled by putting -D_NETBSD_SOURCE in their CFLAGS.
+ It makes most of the #ifs simpler, in that they're all now ORs of the
various macros, rather than having checks for (!defined(_ANSI_SOURCE) ||
!defined(_POSIX_C_SOURCE) || !defined(_XOPEN_SOURCE)) all over the place.
I've tried not to change the semantics of the headers in any case where
_NETBSD_SOURCE wasn't defined, but there were some places where the
current semantics were clearly mad, and retaining them was harder than
correcting them. In particular, I've mostly normalised things so that
_ANSI_SOURCE gets you the smallest set of stuff, then _POSIX_C_SOURCE,
_XOPEN_SOURCE and _NETBSD_SOURCE in that order.
Tested by building for vax, encouraged by thorpej, and uncontested in
tech-userlevel for a week.
2003-04-29 03:16:11 +04:00
|
|
|
#if defined(_NETBSD_SOURCE) || defined(_REENTRANT)
|
1994-08-11 00:48:16 +04:00
|
|
|
/*
|
|
|
|
* Float versions of reentrant version of gamma & lgamma; passes
|
|
|
|
* signgam back by reference as the second argument; user must
|
|
|
|
* allocate space for signgam.
|
|
|
|
*/
|
2005-02-03 07:39:32 +03:00
|
|
|
float gammaf_r(float, int *);
|
|
|
|
float lgammaf_r(float, int *);
|
1998-05-07 22:50:08 +04:00
|
|
|
#endif /* !... || _REENTRANT */
|
1994-08-11 00:48:16 +04:00
|
|
|
|
2004-01-15 22:43:44 +03:00
|
|
|
/*
|
|
|
|
* Library implementation
|
|
|
|
*/
|
2005-02-03 07:39:32 +03:00
|
|
|
int __fpclassifyf(float);
|
|
|
|
int __fpclassifyd(double);
|
|
|
|
int __isfinitef(float);
|
|
|
|
int __isfinited(double);
|
|
|
|
int __isinff(float);
|
|
|
|
int __isinfd(double);
|
|
|
|
int __isnanf(float);
|
|
|
|
int __isnand(double);
|
|
|
|
int __signbitf(float);
|
|
|
|
int __signbitd(double);
|
2004-01-15 22:43:44 +03:00
|
|
|
|
|
|
|
#ifdef __HAVE_LONG_DOUBLE
|
2005-02-03 07:39:32 +03:00
|
|
|
int __fpclassifyl(long double);
|
|
|
|
int __isfinitel(long double);
|
|
|
|
int __isinfl(long double);
|
|
|
|
int __isnanl(long double);
|
|
|
|
int __signbitl(long double);
|
2004-01-15 22:43:44 +03:00
|
|
|
#endif
|
2011-07-26 20:10:15 +04:00
|
|
|
|
2024-01-22 15:15:19 +03:00
|
|
|
/* XXX: Probable temporary hacks for new math functions - 20240122 */
|
|
|
|
double cospi(double);
|
|
|
|
float cospif(float);
|
|
|
|
double sinpi(double);
|
|
|
|
float sinpif(float);
|
|
|
|
double tanpi(double);
|
|
|
|
float tanpif(float);
|
|
|
|
|
|
|
|
long double cospil(long double);
|
|
|
|
long double lgammal_r(long double, int *);
|
|
|
|
long double sinpil(long double);
|
|
|
|
long double tanpil(long double);
|
|
|
|
|
1993-03-21 12:45:37 +03:00
|
|
|
__END_DECLS
|
|
|
|
|
|
|
|
#endif /* _MATH_H_ */
|