1994-08-19 05:40:01 -04:00
|
|
|
/*
|
|
|
|
|
* ====================================================
|
|
|
|
|
* Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* Developed at SunPro, a Sun Microsystems, Inc. business.
|
|
|
|
|
* Permission to use, copy, modify, and distribute this
|
1995-05-30 01:51:47 -04:00
|
|
|
* software is freely granted, provided that this notice
|
1994-08-19 05:40:01 -04:00
|
|
|
* is preserved.
|
|
|
|
|
* ====================================================
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* from: @(#)fdlibm.h 5.1 93/09/24
|
1999-08-27 20:22:10 -04:00
|
|
|
* $FreeBSD$
|
1994-08-19 05:40:01 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _MATH_H_
|
2001-12-13 12:22:17 -05:00
|
|
|
#define _MATH_H_
|
1994-08-19 05:40:01 -04:00
|
|
|
|
2004-06-09 06:32:05 -04:00
|
|
|
#include <sys/cdefs.h>
|
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.
This was developed by David Schultz and myself with input from bde and
fenner.
PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)
2003-02-08 15:37:55 -05:00
|
|
|
#include <sys/_types.h>
|
2004-06-19 05:25:21 -04:00
|
|
|
#include <machine/_limits.h>
|
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.
This was developed by David Schultz and myself with input from bde and
fenner.
PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)
2003-02-08 15:37:55 -05:00
|
|
|
|
1994-08-19 05:40:01 -04:00
|
|
|
/*
|
|
|
|
|
* ANSI/POSIX
|
|
|
|
|
*/
|
2002-10-31 18:05:20 -05:00
|
|
|
extern const union __infinity_un {
|
|
|
|
|
unsigned char __uc[8];
|
|
|
|
|
double __ud;
|
|
|
|
|
} __infinity;
|
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.
This was developed by David Schultz and myself with input from bde and
fenner.
PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)
2003-02-08 15:37:55 -05:00
|
|
|
|
|
|
|
|
extern const union __nan_un {
|
|
|
|
|
unsigned char __uc[sizeof(float)];
|
|
|
|
|
float __uf;
|
|
|
|
|
} __nan;
|
|
|
|
|
|
2004-09-17 01:15:33 -04:00
|
|
|
#if __GNUC_PREREQ__(3, 3) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
|
Define the following macros in terms of [gi]cc builtins when the
builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY,
and NAN. These macros now expand to floating-point constant
expressions rather than external references, as required by C99.
Other compilers will retain the historical behavior. Note that
it is not possible say, e.g.
#define HUGE_VAL 1.0e9999
because the above may result in diagnostics at translation time
and spurious exceptions at runtime. Hence the need for compiler
support for these features.
Also use builtins to implement the macros isgreater(),
isgreaterequal(), isless(), islessequal(), islessgreater(),
and isunordered() when such builtins are available.
Although the old macros are correct, the builtin versions
are much faster, and they avoid double-expansion problems.
2004-07-08 23:31:09 -04:00
|
|
|
#define __MATH_BUILTIN_CONSTANTS
|
|
|
|
|
#endif
|
|
|
|
|
|
2004-09-17 01:15:33 -04:00
|
|
|
#if __GNUC_PREREQ__(3, 0) && !defined(__INTEL_COMPILER)
|
Define the following macros in terms of [gi]cc builtins when the
builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY,
and NAN. These macros now expand to floating-point constant
expressions rather than external references, as required by C99.
Other compilers will retain the historical behavior. Note that
it is not possible say, e.g.
#define HUGE_VAL 1.0e9999
because the above may result in diagnostics at translation time
and spurious exceptions at runtime. Hence the need for compiler
support for these features.
Also use builtins to implement the macros isgreater(),
isgreaterequal(), isless(), islessequal(), islessgreater(),
and isunordered() when such builtins are available.
Although the old macros are correct, the builtin versions
are much faster, and they avoid double-expansion problems.
2004-07-08 23:31:09 -04:00
|
|
|
#define __MATH_BUILTIN_RELOPS
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#ifdef __MATH_BUILTIN_CONSTANTS
|
|
|
|
|
#define HUGE_VAL __builtin_huge_val()
|
|
|
|
|
#else
|
2004-04-24 22:35:42 -04:00
|
|
|
#define HUGE_VAL (__infinity.__ud)
|
Define the following macros in terms of [gi]cc builtins when the
builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY,
and NAN. These macros now expand to floating-point constant
expressions rather than external references, as required by C99.
Other compilers will retain the historical behavior. Note that
it is not possible say, e.g.
#define HUGE_VAL 1.0e9999
because the above may result in diagnostics at translation time
and spurious exceptions at runtime. Hence the need for compiler
support for these features.
Also use builtins to implement the macros isgreater(),
isgreaterequal(), isless(), islessequal(), islessgreater(),
and isunordered() when such builtins are available.
Although the old macros are correct, the builtin versions
are much faster, and they avoid double-expansion problems.
2004-07-08 23:31:09 -04:00
|
|
|
#endif
|
2004-04-24 22:35:42 -04:00
|
|
|
|
|
|
|
|
#if __ISO_C_VISIBLE >= 1999
|
2004-06-19 05:25:21 -04:00
|
|
|
#define FP_ILOGB0 (-__INT_MAX)
|
|
|
|
|
#define FP_ILOGBNAN __INT_MAX
|
Define the following macros in terms of [gi]cc builtins when the
builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY,
and NAN. These macros now expand to floating-point constant
expressions rather than external references, as required by C99.
Other compilers will retain the historical behavior. Note that
it is not possible say, e.g.
#define HUGE_VAL 1.0e9999
because the above may result in diagnostics at translation time
and spurious exceptions at runtime. Hence the need for compiler
support for these features.
Also use builtins to implement the macros isgreater(),
isgreaterequal(), isless(), islessequal(), islessgreater(),
and isunordered() when such builtins are available.
Although the old macros are correct, the builtin versions
are much faster, and they avoid double-expansion problems.
2004-07-08 23:31:09 -04:00
|
|
|
|
|
|
|
|
#ifdef __MATH_BUILTIN_CONSTANTS
|
|
|
|
|
#define HUGE_VALF __builtin_huge_valf()
|
|
|
|
|
#define HUGE_VALL __builtin_huge_vall()
|
2009-01-08 01:12:03 -05:00
|
|
|
#define INFINITY __builtin_inff()
|
|
|
|
|
#define NAN __builtin_nanf("")
|
Define the following macros in terms of [gi]cc builtins when the
builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY,
and NAN. These macros now expand to floating-point constant
expressions rather than external references, as required by C99.
Other compilers will retain the historical behavior. Note that
it is not possible say, e.g.
#define HUGE_VAL 1.0e9999
because the above may result in diagnostics at translation time
and spurious exceptions at runtime. Hence the need for compiler
support for these features.
Also use builtins to implement the macros isgreater(),
isgreaterequal(), isless(), islessequal(), islessgreater(),
and isunordered() when such builtins are available.
Although the old macros are correct, the builtin versions
are much faster, and they avoid double-expansion problems.
2004-07-08 23:31:09 -04:00
|
|
|
#else
|
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.
This was developed by David Schultz and myself with input from bde and
fenner.
PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)
2003-02-08 15:37:55 -05:00
|
|
|
#define HUGE_VALF (float)HUGE_VAL
|
|
|
|
|
#define HUGE_VALL (long double)HUGE_VAL
|
|
|
|
|
#define INFINITY HUGE_VALF
|
|
|
|
|
#define NAN (__nan.__uf)
|
Define the following macros in terms of [gi]cc builtins when the
builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY,
and NAN. These macros now expand to floating-point constant
expressions rather than external references, as required by C99.
Other compilers will retain the historical behavior. Note that
it is not possible say, e.g.
#define HUGE_VAL 1.0e9999
because the above may result in diagnostics at translation time
and spurious exceptions at runtime. Hence the need for compiler
support for these features.
Also use builtins to implement the macros isgreater(),
isgreaterequal(), isless(), islessequal(), islessgreater(),
and isunordered() when such builtins are available.
Although the old macros are correct, the builtin versions
are much faster, and they avoid double-expansion problems.
2004-07-08 23:31:09 -04:00
|
|
|
#endif /* __MATH_BUILTIN_CONSTANTS */
|
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.
This was developed by David Schultz and myself with input from bde and
fenner.
PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)
2003-02-08 15:37:55 -05:00
|
|
|
|
2004-03-12 07:02:03 -05:00
|
|
|
#define MATH_ERRNO 1
|
|
|
|
|
#define MATH_ERREXCEPT 2
|
2005-01-14 17:03:27 -05:00
|
|
|
#define math_errhandling MATH_ERREXCEPT
|
2004-03-12 07:02:03 -05:00
|
|
|
|
2011-10-15 00:24:54 -04:00
|
|
|
#define FP_FAST_FMAF 1
|
2005-01-22 04:53:18 -05:00
|
|
|
|
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.
This was developed by David Schultz and myself with input from bde and
fenner.
PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)
2003-02-08 15:37:55 -05:00
|
|
|
/* Symbolic constants to classify floating point numbers. */
|
2003-02-12 15:03:41 -05:00
|
|
|
#define FP_INFINITE 0x01
|
|
|
|
|
#define FP_NAN 0x02
|
|
|
|
|
#define FP_NORMAL 0x04
|
|
|
|
|
#define FP_SUBNORMAL 0x08
|
|
|
|
|
#define FP_ZERO 0x10
|
2013-07-11 13:41:04 -04:00
|
|
|
|
2013-07-12 07:03:51 -04:00
|
|
|
#if (__STDC_VERSION__ >= 201112L && defined(__clang__)) || \
|
|
|
|
|
__has_extension(c_generic_selections)
|
2013-07-29 08:33:03 -04:00
|
|
|
#define __fp_type_select(x, f, d, ld) _Generic((x), \
|
2013-07-13 06:10:45 -04:00
|
|
|
float: f(x), \
|
|
|
|
|
double: d(x), \
|
2013-07-29 08:33:03 -04:00
|
|
|
long double: ld(x), \
|
|
|
|
|
volatile float: f(x), \
|
|
|
|
|
volatile double: d(x), \
|
|
|
|
|
volatile long double: ld(x), \
|
|
|
|
|
volatile const float: f(x), \
|
|
|
|
|
volatile const double: d(x), \
|
|
|
|
|
volatile const long double: ld(x), \
|
|
|
|
|
const float: f(x), \
|
|
|
|
|
const double: d(x), \
|
|
|
|
|
const long double: ld(x))
|
2013-07-12 07:03:51 -04:00
|
|
|
#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
|
2013-07-13 06:10:45 -04:00
|
|
|
#define __fp_type_select(x, f, d, ld) __builtin_choose_expr( \
|
|
|
|
|
__builtin_types_compatible_p(__typeof(x), long double), ld(x), \
|
|
|
|
|
__builtin_choose_expr( \
|
|
|
|
|
__builtin_types_compatible_p(__typeof(x), double), d(x), \
|
|
|
|
|
__builtin_choose_expr( \
|
|
|
|
|
__builtin_types_compatible_p(__typeof(x), float), f(x), (void)0)))
|
2013-07-11 13:41:04 -04:00
|
|
|
#else
|
2013-07-13 06:10:45 -04:00
|
|
|
#define __fp_type_select(x, f, d, ld) \
|
|
|
|
|
((sizeof(x) == sizeof(float)) ? f(x) \
|
|
|
|
|
: (sizeof(x) == sizeof(double)) ? d(x) \
|
|
|
|
|
: ld(x))
|
2013-07-11 13:41:04 -04:00
|
|
|
#endif
|
|
|
|
|
|
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.
This was developed by David Schultz and myself with input from bde and
fenner.
PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)
2003-02-08 15:37:55 -05:00
|
|
|
#define fpclassify(x) \
|
2013-07-11 15:34:16 -04:00
|
|
|
__fp_type_select(x, __fpclassifyf, __fpclassifyd, __fpclassifyl)
|
2013-07-11 13:41:04 -04:00
|
|
|
#define isfinite(x) __fp_type_select(x, __isfinitef, __isfinite, __isfinitel)
|
|
|
|
|
#define isinf(x) __fp_type_select(x, __isinff, __isinf, __isinfl)
|
|
|
|
|
#define isnan(x) \
|
|
|
|
|
__fp_type_select(x, __inline_isnanf, __inline_isnan, __inline_isnanl)
|
|
|
|
|
#define isnormal(x) __fp_type_select(x, __isnormalf, __isnormal, __isnormall)
|
2003-02-12 15:03:41 -05:00
|
|
|
|
Define the following macros in terms of [gi]cc builtins when the
builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY,
and NAN. These macros now expand to floating-point constant
expressions rather than external references, as required by C99.
Other compilers will retain the historical behavior. Note that
it is not possible say, e.g.
#define HUGE_VAL 1.0e9999
because the above may result in diagnostics at translation time
and spurious exceptions at runtime. Hence the need for compiler
support for these features.
Also use builtins to implement the macros isgreater(),
isgreaterequal(), isless(), islessequal(), islessgreater(),
and isunordered() when such builtins are available.
Although the old macros are correct, the builtin versions
are much faster, and they avoid double-expansion problems.
2004-07-08 23:31:09 -04:00
|
|
|
#ifdef __MATH_BUILTIN_RELOPS
|
|
|
|
|
#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
|
2003-02-12 15:03:41 -05:00
|
|
|
#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)))
|
|
|
|
|
#define isunordered(x, y) (isnan(x) || isnan(y))
|
Define the following macros in terms of [gi]cc builtins when the
builtins are available: HUGE_VAL, HUGE_VALF, HUGE_VALL, INFINITY,
and NAN. These macros now expand to floating-point constant
expressions rather than external references, as required by C99.
Other compilers will retain the historical behavior. Note that
it is not possible say, e.g.
#define HUGE_VAL 1.0e9999
because the above may result in diagnostics at translation time
and spurious exceptions at runtime. Hence the need for compiler
support for these features.
Also use builtins to implement the macros isgreater(),
isgreaterequal(), isless(), islessequal(), islessgreater(),
and isunordered() when such builtins are available.
Although the old macros are correct, the builtin versions
are much faster, and they avoid double-expansion problems.
2004-07-08 23:31:09 -04:00
|
|
|
#endif /* __MATH_BUILTIN_RELOPS */
|
2003-02-12 15:03:41 -05:00
|
|
|
|
2013-07-11 13:41:04 -04:00
|
|
|
#define signbit(x) __fp_type_select(x, __signbitf, __signbit, __signbitl)
|
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.
This was developed by David Schultz and myself with input from bde and
fenner.
PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)
2003-02-08 15:37:55 -05:00
|
|
|
|
|
|
|
|
typedef __double_t double_t;
|
|
|
|
|
typedef __float_t float_t;
|
2004-04-24 22:35:42 -04:00
|
|
|
#endif /* __ISO_C_VISIBLE >= 1999 */
|
1994-08-19 05:40:01 -04:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* XOPEN/SVID
|
|
|
|
|
*/
|
2004-04-24 22:35:42 -04:00
|
|
|
#if __BSD_VISIBLE || __XSI_VISIBLE
|
1994-08-19 05:40:01 -04: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) */
|
|
|
|
|
|
|
|
|
|
#define MAXFLOAT ((float)3.40282346638528860e+38)
|
|
|
|
|
extern int signgam;
|
2004-04-24 22:35:42 -04:00
|
|
|
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
|
1994-08-19 05:40:01 -04:00
|
|
|
|
2004-04-24 22:35:42 -04:00
|
|
|
#if __BSD_VISIBLE
|
2005-01-14 19:37:31 -05:00
|
|
|
#if 0
|
|
|
|
|
/* Old value from 4.4BSD-Lite math.h; this is probably better. */
|
|
|
|
|
#define HUGE HUGE_VAL
|
|
|
|
|
#else
|
|
|
|
|
#define HUGE MAXFLOAT
|
|
|
|
|
#endif
|
2004-04-24 22:35:42 -04:00
|
|
|
#endif /* __BSD_VISIBLE */
|
1994-08-19 05:40:01 -04:00
|
|
|
|
2002-10-01 07:34:42 -04:00
|
|
|
/*
|
2005-01-14 21:55:10 -05:00
|
|
|
* Most of these functions depend on the rounding mode and have the side
|
|
|
|
|
* effect of raising floating-point exceptions, so they are not declared
|
|
|
|
|
* as __pure2. In C99, FENV_ACCESS affects the purity of these functions.
|
2002-10-01 07:34:42 -04:00
|
|
|
*/
|
2002-03-26 04:18:09 -05:00
|
|
|
__BEGIN_DECLS
|
1994-08-19 05:40:01 -04:00
|
|
|
/*
|
|
|
|
|
* ANSI/POSIX
|
|
|
|
|
*/
|
2003-02-12 15:03:41 -05:00
|
|
|
int __fpclassifyd(double) __pure2;
|
|
|
|
|
int __fpclassifyf(float) __pure2;
|
|
|
|
|
int __fpclassifyl(long double) __pure2;
|
Implement the classification macros isfinite(), isinf(), isnan(), and
isnormal() the hard way, rather than relying on fpclassify(). This is
a lose in the sense that we need a total of 12 functions, but it is
necessary for binary compatibility because we have never bumped libm's
major version number. In particular, isinf(), isnan(), and isnanf()
were BSD libc functions before they were C99 macros, so we can't
reimplement them in terms of fpclassify() without adding a dependency
on libc.so.5. I have tried to arrange things so that programs that
could be compiled in FreeBSD 4.X will generate the same external
references when compiled in 5.X. At the same time, the new macros
should remain C99-compliant.
The isinf() and isnan() functions remain in libc for historical
reasons; however, I have moved the functions that implement the macros
isfinite() and isnormal() to libm where they belong. Moreover,
half a dozen MD versions of isinf() and isnan() have been replaced
with MI versions that work equally well.
Prodded by: kris
2004-07-08 23:32:40 -04:00
|
|
|
int __isfinitef(float) __pure2;
|
|
|
|
|
int __isfinite(double) __pure2;
|
|
|
|
|
int __isfinitel(long double) __pure2;
|
|
|
|
|
int __isinff(float) __pure2;
|
2013-07-11 13:41:04 -04:00
|
|
|
int __isinf(double) __pure2;
|
Implement the classification macros isfinite(), isinf(), isnan(), and
isnormal() the hard way, rather than relying on fpclassify(). This is
a lose in the sense that we need a total of 12 functions, but it is
necessary for binary compatibility because we have never bumped libm's
major version number. In particular, isinf(), isnan(), and isnanf()
were BSD libc functions before they were C99 macros, so we can't
reimplement them in terms of fpclassify() without adding a dependency
on libc.so.5. I have tried to arrange things so that programs that
could be compiled in FreeBSD 4.X will generate the same external
references when compiled in 5.X. At the same time, the new macros
should remain C99-compliant.
The isinf() and isnan() functions remain in libc for historical
reasons; however, I have moved the functions that implement the macros
isfinite() and isnormal() to libm where they belong. Moreover,
half a dozen MD versions of isinf() and isnan() have been replaced
with MI versions that work equally well.
Prodded by: kris
2004-07-08 23:32:40 -04:00
|
|
|
int __isinfl(long double) __pure2;
|
|
|
|
|
int __isnormalf(float) __pure2;
|
|
|
|
|
int __isnormal(double) __pure2;
|
|
|
|
|
int __isnormall(long double) __pure2;
|
2003-02-12 15:03:41 -05:00
|
|
|
int __signbit(double) __pure2;
|
2004-07-19 04:16:10 -04:00
|
|
|
int __signbitf(float) __pure2;
|
|
|
|
|
int __signbitl(long double) __pure2;
|
Implement fpclassify():
o Add a MD header private to libc called _fpmath.h; this header
contains bitfield layouts of MD floating-point types.
o Add a MI header private to libc called fpmath.h; this header
contains bitfield layouts of MI floating-point types.
o Add private libc variables to lib/libc/$arch/gen/infinity.c for
storing NaN values.
o Add __double_t and __float_t to <machine/_types.h>, and provide
double_t and float_t typedefs in <math.h>.
o Add some C99 manifest constants (FP_ILOGB0, FP_ILOGBNAN, HUGE_VALF,
HUGE_VALL, INFINITY, NAN, and return values for fpclassify()) to
<math.h> and others (FLT_EVAL_METHOD, DECIMAL_DIG) to <float.h> via
<machine/float.h>.
o Add C99 macro fpclassify() which calls __fpclassify{d,f,l}() based
on the size of its argument. __fpclassifyl() is never called on
alpha because (sizeof(long double) == sizeof(double)), which is good
since __fpclassifyl() can't deal with such a small `long double'.
This was developed by David Schultz and myself with input from bde and
fenner.
PR: 23103
Submitted by: David Schultz <dschultz@uclink.Berkeley.EDU>
(significant portions)
Reviewed by: bde, fenner (earlier versions)
2003-02-08 15:37:55 -05:00
|
|
|
|
2013-07-11 13:41:04 -04:00
|
|
|
static __inline int
|
2013-07-13 06:10:45 -04:00
|
|
|
__inline_isnan(__const double __x)
|
2013-07-11 13:41:04 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return (__x != __x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static __inline int
|
2013-07-13 06:10:45 -04:00
|
|
|
__inline_isnanf(__const float __x)
|
2013-07-11 13:41:04 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return (__x != __x);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static __inline int
|
2013-07-13 06:10:45 -04:00
|
|
|
__inline_isnanl(__const long double __x)
|
2013-07-11 13:41:04 -04:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
return (__x != __x);
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-02 12:59:53 -04:00
|
|
|
/*
|
|
|
|
|
* Define the following aliases, for compatibility with glibc and CUDA.
|
|
|
|
|
*/
|
|
|
|
|
#define __isnan __inline_isnan
|
|
|
|
|
#define __isnanf __inline_isnanf
|
|
|
|
|
|
2013-07-29 04:32:13 -04:00
|
|
|
/*
|
|
|
|
|
* Version 2 of the Single UNIX Specification (UNIX98) defined isnan() and
|
|
|
|
|
* isinf() as functions taking double. C99, and the subsequent POSIX revisions
|
|
|
|
|
* (SUSv3, POSIX.1-2001, define it as a macro that accepts any real floating
|
|
|
|
|
* point type. If we are targeting SUSv2 and C99 or C11 (or C++11) then we
|
|
|
|
|
* expose the newer definition, assuming that the language spec takes
|
|
|
|
|
* precedence over the operating system interface spec.
|
|
|
|
|
*/
|
|
|
|
|
#if __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 && __ISO_C_VISIBLE < 1999
|
|
|
|
|
#undef isinf
|
|
|
|
|
#undef isnan
|
|
|
|
|
int isinf(double);
|
|
|
|
|
int isnan(double);
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-03-21 18:54:04 -05: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);
|
2002-10-01 07:34:42 -04:00
|
|
|
double frexp(double, int *); /* fundamentally !__pure2 */
|
2002-03-21 18:54:04 -05:00
|
|
|
double ldexp(double, int);
|
|
|
|
|
double log(double);
|
|
|
|
|
double log10(double);
|
2002-10-01 07:34:42 -04:00
|
|
|
double modf(double, double *); /* fundamentally !__pure2 */
|
2002-03-21 18:54:04 -05:00
|
|
|
|
|
|
|
|
double pow(double, double);
|
|
|
|
|
double sqrt(double);
|
|
|
|
|
|
|
|
|
|
double ceil(double);
|
2005-01-14 21:55:10 -05:00
|
|
|
double fabs(double) __pure2;
|
2002-03-21 18:54:04 -05:00
|
|
|
double floor(double);
|
|
|
|
|
double fmod(double, double);
|
1994-08-19 05:40:01 -04:00
|
|
|
|
2002-10-01 07:34:42 -04:00
|
|
|
/*
|
2005-01-14 21:55:10 -05:00
|
|
|
* These functions are not in C90.
|
2002-10-01 07:34:42 -04:00
|
|
|
*/
|
2004-04-24 22:35:42 -04:00
|
|
|
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE
|
|
|
|
|
double acosh(double);
|
|
|
|
|
double asinh(double);
|
|
|
|
|
double atanh(double);
|
2005-01-14 21:55:10 -05:00
|
|
|
double cbrt(double);
|
2002-03-21 18:54:04 -05:00
|
|
|
double erf(double);
|
2005-01-14 21:55:10 -05:00
|
|
|
double erfc(double);
|
2005-04-04 22:57:15 -04:00
|
|
|
double exp2(double);
|
2005-01-14 21:55:10 -05:00
|
|
|
double expm1(double);
|
2005-03-17 20:47:42 -05:00
|
|
|
double fma(double, double, double);
|
2002-03-21 18:54:04 -05:00
|
|
|
double hypot(double, double);
|
2005-01-14 21:55:10 -05:00
|
|
|
int ilogb(double) __pure2;
|
2004-04-24 22:35:42 -04:00
|
|
|
double lgamma(double);
|
2005-01-11 18:12:55 -05:00
|
|
|
long long llrint(double);
|
|
|
|
|
long long llround(double);
|
2005-01-14 21:55:10 -05:00
|
|
|
double log1p(double);
|
2010-12-05 17:11:22 -05:00
|
|
|
double log2(double);
|
2005-01-14 21:55:10 -05:00
|
|
|
double logb(double);
|
2005-01-11 18:12:55 -05:00
|
|
|
long lrint(double);
|
|
|
|
|
long lround(double);
|
2007-12-16 16:19:28 -05:00
|
|
|
double nan(const char *) __pure2;
|
2004-04-24 22:35:42 -04:00
|
|
|
double nextafter(double, double);
|
|
|
|
|
double remainder(double, double);
|
2005-03-24 23:40:44 -05:00
|
|
|
double remquo(double, double, int *);
|
2005-01-14 21:55:10 -05:00
|
|
|
double rint(double);
|
2004-04-24 22:35:42 -04:00
|
|
|
#endif /* __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE */
|
|
|
|
|
|
|
|
|
|
#if __BSD_VISIBLE || __XSI_VISIBLE
|
2002-03-21 18:54:04 -05:00
|
|
|
double j0(double);
|
|
|
|
|
double j1(double);
|
|
|
|
|
double jn(int, double);
|
|
|
|
|
double y0(double);
|
|
|
|
|
double y1(double);
|
|
|
|
|
double yn(int, double);
|
1994-08-19 05:40:01 -04:00
|
|
|
|
2004-04-24 22:35:42 -04:00
|
|
|
#if __XSI_VISIBLE <= 500 || __BSD_VISIBLE
|
|
|
|
|
double gamma(double);
|
1997-08-31 18:12:19 -04:00
|
|
|
#endif
|
2009-03-14 14:58:53 -04:00
|
|
|
|
|
|
|
|
#if __XSI_VISIBLE <= 600 || __BSD_VISIBLE
|
|
|
|
|
double scalb(double, double);
|
|
|
|
|
#endif
|
2004-04-24 22:35:42 -04:00
|
|
|
#endif /* __BSD_VISIBLE || __XSI_VISIBLE */
|
1994-08-19 05:40:01 -04:00
|
|
|
|
2004-04-24 22:35:42 -04:00
|
|
|
#if __BSD_VISIBLE || __ISO_C_VISIBLE >= 1999
|
2002-10-01 07:34:42 -04:00
|
|
|
double copysign(double, double) __pure2;
|
2004-07-17 11:03:52 -04:00
|
|
|
double fdim(double, double);
|
|
|
|
|
double fmax(double, double) __pure2;
|
|
|
|
|
double fmin(double, double) __pure2;
|
2005-01-14 21:55:10 -05:00
|
|
|
double nearbyint(double);
|
2004-07-17 11:03:52 -04:00
|
|
|
double round(double);
|
2004-06-20 05:26:41 -04:00
|
|
|
double scalbln(double, long);
|
2002-03-21 18:54:04 -05:00
|
|
|
double scalbn(double, int);
|
2004-04-24 22:35:42 -04:00
|
|
|
double tgamma(double);
|
2004-07-17 11:03:52 -04:00
|
|
|
double trunc(double);
|
2004-04-24 22:35:42 -04:00
|
|
|
#endif
|
1994-08-19 05:40:01 -04:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* BSD math library entry points
|
|
|
|
|
*/
|
2004-04-24 22:35:42 -04:00
|
|
|
#if __BSD_VISIBLE
|
2002-03-21 18:54:04 -05:00
|
|
|
double drem(double, double);
|
2004-04-24 22:35:42 -04:00
|
|
|
int finite(double) __pure2;
|
Implement the classification macros isfinite(), isinf(), isnan(), and
isnormal() the hard way, rather than relying on fpclassify(). This is
a lose in the sense that we need a total of 12 functions, but it is
necessary for binary compatibility because we have never bumped libm's
major version number. In particular, isinf(), isnan(), and isnanf()
were BSD libc functions before they were C99 macros, so we can't
reimplement them in terms of fpclassify() without adding a dependency
on libc.so.5. I have tried to arrange things so that programs that
could be compiled in FreeBSD 4.X will generate the same external
references when compiled in 5.X. At the same time, the new macros
should remain C99-compliant.
The isinf() and isnan() functions remain in libc for historical
reasons; however, I have moved the functions that implement the macros
isfinite() and isnormal() to libm where they belong. Moreover,
half a dozen MD versions of isinf() and isnan() have been replaced
with MI versions that work equally well.
Prodded by: kris
2004-07-08 23:32:40 -04:00
|
|
|
int isnanf(float) __pure2;
|
1994-08-19 05:40:01 -04:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Reentrant version of gamma & lgamma; passes signgam back by reference
|
|
|
|
|
* as the second argument; user must allocate space for signgam.
|
|
|
|
|
*/
|
2002-03-21 18:54:04 -05:00
|
|
|
double gamma_r(double, int *);
|
|
|
|
|
double lgamma_r(double, int *);
|
2004-04-24 22:35:42 -04:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* IEEE Test Vector
|
|
|
|
|
*/
|
|
|
|
|
double significand(double);
|
2003-02-26 08:12:03 -05:00
|
|
|
#endif /* __BSD_VISIBLE */
|
1994-08-19 05:40:01 -04:00
|
|
|
|
|
|
|
|
/* float versions of ANSI/POSIX functions */
|
2004-04-24 22:35:42 -04:00
|
|
|
#if __ISO_C_VISIBLE >= 1999
|
2002-03-21 18:54:04 -05:00
|
|
|
float acosf(float);
|
|
|
|
|
float asinf(float);
|
|
|
|
|
float atanf(float);
|
|
|
|
|
float atan2f(float, float);
|
|
|
|
|
float cosf(float);
|
|
|
|
|
float sinf(float);
|
|
|
|
|
float tanf(float);
|
|
|
|
|
|
|
|
|
|
float coshf(float);
|
|
|
|
|
float sinhf(float);
|
|
|
|
|
float tanhf(float);
|
|
|
|
|
|
2005-04-04 22:57:15 -04:00
|
|
|
float exp2f(float);
|
2002-03-21 18:54:04 -05:00
|
|
|
float expf(float);
|
2005-01-14 21:55:10 -05:00
|
|
|
float expm1f(float);
|
2002-10-01 07:34:42 -04:00
|
|
|
float frexpf(float, int *); /* fundamentally !__pure2 */
|
2005-01-14 21:55:10 -05:00
|
|
|
int ilogbf(float) __pure2;
|
2002-03-21 18:54:04 -05:00
|
|
|
float ldexpf(float, int);
|
|
|
|
|
float log10f(float);
|
2005-01-14 21:55:10 -05:00
|
|
|
float log1pf(float);
|
2010-12-05 17:11:22 -05:00
|
|
|
float log2f(float);
|
2004-04-24 22:35:42 -04:00
|
|
|
float logf(float);
|
2002-10-01 07:34:42 -04:00
|
|
|
float modff(float, float *); /* fundamentally !__pure2 */
|
2002-03-21 18:54:04 -05:00
|
|
|
|
|
|
|
|
float powf(float, float);
|
|
|
|
|
float sqrtf(float);
|
|
|
|
|
|
|
|
|
|
float ceilf(float);
|
2005-01-14 21:55:10 -05:00
|
|
|
float fabsf(float) __pure2;
|
2002-03-21 18:54:04 -05:00
|
|
|
float floorf(float);
|
|
|
|
|
float fmodf(float, float);
|
2004-06-07 04:05:36 -04:00
|
|
|
float roundf(float);
|
2002-03-21 18:54:04 -05:00
|
|
|
|
|
|
|
|
float erff(float);
|
2005-01-14 21:55:10 -05:00
|
|
|
float erfcf(float);
|
|
|
|
|
float hypotf(float, float);
|
2002-03-21 18:54:04 -05:00
|
|
|
float lgammaf(float);
|
2008-02-18 12:27:11 -05:00
|
|
|
float tgammaf(float);
|
2002-03-21 18:54:04 -05:00
|
|
|
|
|
|
|
|
float acoshf(float);
|
|
|
|
|
float asinhf(float);
|
|
|
|
|
float atanhf(float);
|
2005-01-14 21:55:10 -05:00
|
|
|
float cbrtf(float);
|
|
|
|
|
float logbf(float);
|
2004-04-24 22:35:42 -04:00
|
|
|
float copysignf(float, float) __pure2;
|
2005-01-11 18:12:55 -05:00
|
|
|
long long llrintf(float);
|
|
|
|
|
long long llroundf(float);
|
|
|
|
|
long lrintf(float);
|
|
|
|
|
long lroundf(float);
|
2007-12-16 16:19:28 -05:00
|
|
|
float nanf(const char *) __pure2;
|
2005-01-14 21:55:10 -05:00
|
|
|
float nearbyintf(float);
|
2002-03-21 18:54:04 -05:00
|
|
|
float nextafterf(float, float);
|
|
|
|
|
float remainderf(float, float);
|
2005-03-24 23:40:44 -05:00
|
|
|
float remquof(float, float, int *);
|
2002-03-21 18:54:04 -05:00
|
|
|
float rintf(float);
|
2004-06-20 05:26:41 -04:00
|
|
|
float scalblnf(float, long);
|
2002-03-21 18:54:04 -05:00
|
|
|
float scalbnf(float, int);
|
2004-06-20 05:26:41 -04:00
|
|
|
float truncf(float);
|
2004-06-30 03:04:01 -04:00
|
|
|
|
|
|
|
|
float fdimf(float, float);
|
2005-03-17 20:47:42 -05:00
|
|
|
float fmaf(float, float, float);
|
2004-06-30 03:04:01 -04:00
|
|
|
float fmaxf(float, float) __pure2;
|
|
|
|
|
float fminf(float, float) __pure2;
|
2004-04-24 22:35:42 -04:00
|
|
|
#endif
|
1994-08-19 05:40:01 -04:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* float versions of BSD math library entry points
|
|
|
|
|
*/
|
2004-04-24 22:35:42 -04:00
|
|
|
#if __BSD_VISIBLE
|
2002-03-21 18:54:04 -05:00
|
|
|
float dremf(float, float);
|
2004-04-24 22:35:42 -04:00
|
|
|
int finitef(float) __pure2;
|
|
|
|
|
float gammaf(float);
|
|
|
|
|
float j0f(float);
|
|
|
|
|
float j1f(float);
|
|
|
|
|
float jnf(int, float);
|
|
|
|
|
float scalbf(float, float);
|
|
|
|
|
float y0f(float);
|
|
|
|
|
float y1f(float);
|
|
|
|
|
float ynf(int, float);
|
1994-08-19 05:40:01 -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.
|
|
|
|
|
*/
|
2002-03-21 18:54:04 -05:00
|
|
|
float gammaf_r(float, int *);
|
|
|
|
|
float lgammaf_r(float, int *);
|
2004-04-24 22:35:42 -04:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* float version of IEEE Test Vector
|
|
|
|
|
*/
|
|
|
|
|
float significandf(float);
|
2003-02-26 08:12:03 -05:00
|
|
|
#endif /* __BSD_VISIBLE */
|
1994-08-19 05:40:01 -04:00
|
|
|
|
2003-10-23 04:23:38 -04:00
|
|
|
/*
|
|
|
|
|
* long double versions of ISO/POSIX math functions
|
|
|
|
|
*/
|
2004-04-24 22:35:42 -04:00
|
|
|
#if __ISO_C_VISIBLE >= 1999
|
2013-06-10 02:04:58 -04:00
|
|
|
long double acoshl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double acosl(long double);
|
2013-06-10 02:04:58 -04:00
|
|
|
long double asinhl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double asinl(long double);
|
|
|
|
|
long double atan2l(long double, long double);
|
2013-06-10 02:04:58 -04:00
|
|
|
long double atanhl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double atanl(long double);
|
|
|
|
|
long double cbrtl(long double);
|
2005-01-13 04:11:41 -05:00
|
|
|
long double ceill(long double);
|
2005-01-14 21:55:10 -05:00
|
|
|
long double copysignl(long double, long double) __pure2;
|
2013-12-29 20:06:21 -05:00
|
|
|
long double coshl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double cosl(long double);
|
2014-07-13 13:05:03 -04:00
|
|
|
long double erfcl(long double);
|
|
|
|
|
long double erfl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double exp2l(long double);
|
2012-07-23 15:13:55 -04:00
|
|
|
long double expl(long double);
|
2013-06-03 15:51:32 -04:00
|
|
|
long double expm1l(long double);
|
2005-01-14 21:55:10 -05:00
|
|
|
long double fabsl(long double) __pure2;
|
2003-10-23 04:23:38 -04:00
|
|
|
long double fdiml(long double, long double);
|
|
|
|
|
long double floorl(long double);
|
|
|
|
|
long double fmal(long double, long double, long double);
|
2004-06-30 03:04:01 -04:00
|
|
|
long double fmaxl(long double, long double) __pure2;
|
|
|
|
|
long double fminl(long double, long double) __pure2;
|
2003-10-23 04:23:38 -04:00
|
|
|
long double fmodl(long double, long double);
|
2016-06-09 16:49:26 -04:00
|
|
|
long double frexpl(long double, int *); /* fundamentally !__pure2 */
|
2003-10-23 04:23:38 -04:00
|
|
|
long double hypotl(long double, long double);
|
2005-01-14 21:55:10 -05:00
|
|
|
int ilogbl(long double) __pure2;
|
2003-10-23 04:23:38 -04:00
|
|
|
long double ldexpl(long double, int);
|
2014-08-09 11:53:40 -04:00
|
|
|
long double lgammal(long double);
|
2008-01-13 21:12:07 -05:00
|
|
|
long long llrintl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long long llroundl(long double);
|
2013-06-03 05:14:31 -04:00
|
|
|
long double log10l(long double);
|
|
|
|
|
long double log1pl(long double);
|
|
|
|
|
long double log2l(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double logbl(long double);
|
2013-06-03 05:14:31 -04:00
|
|
|
long double logl(long double);
|
2008-01-13 21:12:07 -05:00
|
|
|
long lrintl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long lroundl(long double);
|
2005-01-14 21:55:10 -05:00
|
|
|
long double modfl(long double, long double *); /* fundamentally !__pure2 */
|
|
|
|
|
long double nanl(const char *) __pure2;
|
2003-10-23 04:23:38 -04:00
|
|
|
long double nearbyintl(long double);
|
|
|
|
|
long double nextafterl(long double, long double);
|
|
|
|
|
double nexttoward(double, long double);
|
|
|
|
|
float nexttowardf(float, long double);
|
|
|
|
|
long double nexttowardl(long double, long double);
|
2014-08-09 11:53:40 -04:00
|
|
|
long double powl(long double, long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double remainderl(long double, long double);
|
|
|
|
|
long double remquol(long double, long double, int *);
|
2008-01-13 21:12:07 -05:00
|
|
|
long double rintl(long double);
|
2005-04-07 21:24:08 -04:00
|
|
|
long double roundl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double scalblnl(long double, long);
|
|
|
|
|
long double scalbnl(long double, int);
|
2013-12-29 20:06:21 -05:00
|
|
|
long double sinhl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double sinl(long double);
|
|
|
|
|
long double sqrtl(long double);
|
2013-12-29 20:06:21 -05:00
|
|
|
long double tanhl(long double);
|
2003-10-23 04:23:38 -04:00
|
|
|
long double tanl(long double);
|
2014-08-09 11:53:40 -04:00
|
|
|
long double tgammal(long double);
|
2005-04-16 17:12:47 -04:00
|
|
|
long double truncl(long double);
|
2004-04-24 22:35:42 -04:00
|
|
|
#endif /* __ISO_C_VISIBLE >= 1999 */
|
2014-09-15 19:21:57 -04:00
|
|
|
|
|
|
|
|
#if __BSD_VISIBLE
|
|
|
|
|
long double lgammal_r(long double, int *);
|
2017-05-28 02:13:38 -04:00
|
|
|
void sincos(double, double *, double *);
|
|
|
|
|
void sincosf(float, float *, float *);
|
|
|
|
|
void sincosl(long double, long double *, long double *);
|
2014-09-15 19:21:57 -04:00
|
|
|
#endif
|
|
|
|
|
|
1994-08-19 05:40:01 -04:00
|
|
|
__END_DECLS
|
|
|
|
|
|
2001-12-13 12:22:17 -05:00
|
|
|
#endif /* !_MATH_H_ */
|