// Rowley C Compiler, runtime support. // // Copyright (c) 2001, 2002, 2003, 2010 Rowley Associates Limited. // // This file may be distributed under the terms of the License Agreement // provided with this software. // // THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE // WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. #ifndef __math_h #define __math_h #define FP_ZERO 0x00 #define FP_SUBNORMAL 0x01 #define FP_NORMAL 0x02 #define FP_INFINITE 0x03 #define FP_NAN 0x04 #ifndef __ASSEMBLY_INCLUDE #ifdef __cplusplus extern "C" { #endif // These are stored in memory; don't ask, it's hard to do this stuff in a portable manner. extern const float __float32_infinity; extern const double __float64_infinity; extern const float __float32_nan; extern const double __float64_nan; #if defined(__CROSSWORKS_AVR) || defined(__CROSSWORKS_MSP430) || defined(__CROSSWORKS_MAXQ) || defined(__CROSSWORKS_MAXQ) #define HUGE_VAL __maxof(double) #define HUGE_VALF __maxof(float) #define INFINITY __infinityof(float) #else #define INFINITY __float32_infinity #ifdef __SHORT_DOUBLES #define HUGE_VAL __float32_infinity #else #define HUGE_VAL __float64_infinity #endif #define HUGE_VALF __float32_infinity #endif /*! \brief Test for infinity \ingroup Type Generic Macros \synopsis \description \this determines whether \a x is an infinity (positive or negative). The determination is based on the type of the argument. */ #define isinf(x) (sizeof(x) == sizeof(float) ? __float32_isinf(x) : __float64_isinf(x)) /*! \brief Test for NaN\ingroup Type Generic Macros \synopsis \description \this determines whether \a x is a NaN. The determination is based on the type of the argument. */ #define isnan(x) (sizeof(x) == sizeof(float) ? __float32_isnan(x) : __float64_isnan(x)) /*! \brief Test for a finite value\ingroup Type Generic Macros \synopsis \description \this determines whether \a x is a finite value (zero, subnormal, or normal, and not infinite or NaN). The \this macro returns a non-zero value if and only if its argument has a finite value. */ #define isfinite(x) (sizeof(x) == sizeof(float) ? __float32_isfinite(x) : __float64_isfinite(x)) /*! \brief Test for a normal value\ingroup Type Generic Macros \synopsis \description \this determines whether \a x is a normal value (zero, subnormal, or normal, and not infinite or NaN). The \this macro returns a non-zero value if and only if its argument has a normal value. */ #define isnormal(x) (sizeof(x) == sizeof(float) ? __float32_isnormal(x) : __float64_isnormal(x)) /*! \brief Test sign\ingroup Type Generic Macros \synopsis \description \this macro shall determine whether the sign of its argument value is negative. The \this macro returns a non-zero value if and only if its argument value is negative. */ #define signbit(x) (sizeof(x) == sizeof(float) ? __float32_signbit(x) : __float64_signbit(x)) /*! \brief Classify floating type\ingroup Type Generic Macros \synopsis \description \this macro shall classify its argument value as NaN, infinite, normal, subnormal, zero, or into another implementation-defined category. The \this macro returns the value of the number classification macro one of \item FP_ZERO \item FP_SUBNORMAL \item FP_NORMAL \item FP_INFINITE \item FP_NAN */ #define fpclassify(x) (sizeof(x) == sizeof(float) ? __float32_classify(x) : __float64_classify(x)) // This is simple. typedef float float_t; typedef double double_t; /*! \brief Compute cosine of a float \ingroup Trigonometric functions \synopsis \desc \b \this returns the radian circular cosine of x. If |\a x| \gt 10^9, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. If \a x is NaN, \b \this returns \a x. If |\a x| is \inf, \b \this returns NaN. */ float cosf(float __x); /*! \brief Compute cosine of a double \ingroup Trigonometric functions \synopsis \desc \b \this returns the radian circular cosine of \a x. If |\a x| \gt 10^9, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. If \a x is NaN, \b \this returns \a x. If |\a x| is \inf, \b \this returns NaN. */ double cos(double __x); /*! \brief Compute sine of a float \ingroup Trigonometric functions \synopsis \desc \b \this returns the radian circular sine of \a x. If |\a x| \gt 10^9, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. \b \this returns \a x if \a x is NaN. \b \this returns NaN if |\a x| is \inf. */ float sinf(float __x); /*! \brief Compute sine of a double \ingroup Trigonometric functions \synopsis \desc \b \this returns the radian circular sine of \a x. If |\a x| \gt 10^9, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. \b \this returns \a x if \a x is NaN. \b \this returns NaN if |\a x| is \inf. */ double sin(double __x); /*! \brief Compute tangent of a double \ingroup Trigonometric functions \synopsis \desc \b \this returns the radian circular tangent of \a x. If |\a x| \gt 10^9, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. If \a x is NaN, \this returns \a x. If |\a x| is \inf, \this returns NaN. */ float tanf(float __x); /*! \brief Compute tangent of a double \ingroup Trigonometric functions \synopsis \desc \b \this returns the radian circular tangent of \a x. If |\a x| \gt 10^9, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. If \a x is NaN, \b \this returns \a x. If |\a x| is \inf, \b \this returns NaN. */ double tan(double __x); /*! \brief Compute inverse cosine of a float \ingroup Inverse trigonometric functions \synopsis \desc \b \this returns the principal value, in radians, of the inverse circular cosine of \a x. The principal value lies in the interval [0, PI] radians. If |\b a| 1, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. If \a x is NaN, \b \this returns \a x. If |\a x| \gt 1, \b \this returns NaN. */ float acosf(float __x); /*! \brief Compute inverse cosine of a double \ingroup Inverse trigonometric functions \synopsis \desc \b \this returns the principal value, in radians, of the inverse circular cosine of \a x. The principal value lies in the interval [0, PI] radians. If |\a x| > 1, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. If \a x is NaN, \b \this returns \a x. If |\a x| \gt 1, \b \this returns NaN. */ double acos(double __x); /*! \brief Compute inverse sine of a float \ingroup Inverse trigonometric functions \synopsis \desc \b \this returns the principal value, in radians, of the inverse circular sine of \b val. The principal value lies in the interval [\minus\half\pi, +\half\pi] radians. If |\a x| \gt 1, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. If \a x is NaN, \b \this returns \a x. If |\a x| \gt 1, \b \this returns NaN. */ float asinf(float __x); /*! \brief Compute inverse sine of a double \ingroup Inverse trigonometric functions \synopsis \desc \b \this returns the principal value, in radians, of the inverse circular sine of \a x. The principal value lies in the interval [\minus\half\pi, +\half\pi] radians. If |\a x| \gt 1, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. If \a x is NaN, \b \this returns \a x. If |\a x| \gt 1, \b \this returns NaN. */ double asin(double __x); /*! \brief Compute inverse tangent of a float \ingroup Inverse trigonometric functions \synopsis \desc \b \this returns the principal value, in radians, of the inverse circular tangent of \a x. The principal value lies in the interval [\minus\half\pi, +\half\pi] radians. */ float atanf(float __x); /*! \brief Compute inverse tangent of a double \ingroup Inverse trigonometric functions \synopsis \desc \b \this returns the principal value, in radians, of the inverse circular tangent of \a x. The principal value lies in the interval [\minus\half\pi, +\half\pi] radians. */ double atan(double __x); /*! \brief Compute inverse tangent of a ratio of floats \ingroup Inverse trigonometric functions \synopsis \desc \b \this returns the value, in radians, of the inverse circular tangent of \b y divided by \a x using the signs of \a x and \b y to compute the quadrant of the return value. The principal value lies in the interval [\minus\half\pi, +\half\pi] radians. If \a x = \b y = 0, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. \b \this(\a x, NaN) is NaN. \n \b \this(NaN, \a x) is NaN. \n \b \this(\plusminus~0, +(anything but NaN)) is \plusminus~0. \n \b \this(\plusminus~0, \minus(anything but NaN)) is \plusminus\pi. \n \b \this(\plusminus(anything but 0 and NaN), 0) is \plusminus\half\pi. \n \b \this(\plusminus(anything but \inf and NaN), +\inf) is \plusminus~0. \n \b \this(\plusminus(anything but \inf and NaN), \minus\inf) is \plusminus\pi. \n \b \this(\plusminus\inf, +\inf) is \plusminus\quarter\pi. \n \b \this(\plusminus\inf, \minus\inf) is \plusminus\threequarter\pi. \n \b \this(\plusminus\inf, (anything but 0, NaN, and \inf)) is \plusminus\half\pi. */ float atan2f(float __x, float __y); /*! \brief Compute inverse tangent of a ratio of doubles \ingroup Inverse trigonometric functions \synopsis \desc \b \this returns the value, in radians, of the inverse circular tangent of \b y divided by \a x using the signs of \a x and \b y to compute the quadrant of the return value. The principal value lies in the interval [\minus\half\pi/2, +\half\pi] radians. If \a x = \b y = 0, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. \b \this(\a x, NaN) is NaN. \n \b \this(NaN, \a x) is NaN. \n \b \this(\plusminus~0, +(anything but NaN)) is \plusminus~0. \n \b \this(\plusminus~0, \minus(anything but NaN)) is \plusminus\pi. \n \b \this(\plusminus(anything but 0 and NaN), 0) is \plusminus\half\pi. \n \b \this(\plusminus(anything but \inf and NaN), +\inf) is \plusminus~0. \n \b \this(\plusminus(anything but \inf and NaN), \minus\inf) is \plusminus\pi. \n \b \this(\plusminus\inf, +\inf) is \plusminus\quarter\pi. \n \b \this(\plusminus\inf, \minus\inf) is \plusminus\threequarter\pi. \n \b \this(\plusminus\inf, (anything but 0, NaN, and \inf)) is \plusminus\half\pi. */ double atan2(double __x, double __y); /*! \brief Set exponent of a float \ingroup Exponential and logarithmic functions \synopsis \desc \b \this breaks a floating-point number into a normalized fraction and an integral power of 2. \b \this stores power of two in the \b int object pointed to by \b \this and returns the value \a x, such that \a x has a magnitude in the interval [\half, 1) or zero, and value equals \a x * 2^\a exp. If \a x is zero, both parts of the result are zero. If \a x is \inf or NaN, \b \this \b returns \a x and stores zero into the int object pointed to by \a exp. */ float frexpf(float __x, int *__exp); /*! \brief Set exponent of a double \ingroup Exponential and logarithmic functions \synopsis \desc \b \this breaks a floating-point number into a normalized fraction and an integral power of 2. \b \this stores power of two in the \b int object pointed to by \a exp and returns the value \a x, such that \a x has a magnitude in the interval [1/2, 1) or zero, and value equals \a x * 2^\a exp. If \a x is zero, both parts of the result are zero. If \a x is \inf or NaN, \b \this returns \a x and stores zero into the int object pointed to by \a exp. */ double frexp(double __x, int *__exp); /*! \brief Adjust exponent of a float \ingroup Exponential and logarithmic functions \synopsis \desc \b \this multiplies a floating-point number by an integral power of 2. \b \this returns \a x * 2^\b exp. If the result overflows, \b errno is set to \b ERANGE and \b \this returns \b HUGE_VALF. If \a x is \inf or NaN, \b \this returns \a x. If the result overflows, \b \this returns \inf. */ float ldexpf(float __x, int __exp); /*! \brief Adjust exponent of a double \ingroup Exponential and logarithmic functions \synopsis \desc \b \this multiplies a floating-point number by an integral power of 2. \b \this returns \a x * 2^\b exp. If the result overflows, \b errno is set to \b ERANGE and \b \this returns \b HUGE_VALF. If \a x is \inf or NaN, \b \this returns \a x. If the result overflows, \b \this returns \inf. */ double ldexp(double __x, int __exp); /*! \brief Scale a float \ingroup Exponential and logarithmic functions \synopsis \desc \b \this multiplies a floating-point number by an integral power of \b FLT_RADIX. As floating-point arithmetic conforms to IEC 60559, \b FLT_RADIX is 2 and \b \this is (in this implementation) identical to \b ldexpf. \b \this returns \a x * \b FLT_RADIX ^\b exp. If the result overflows, \b errno is set to \b ERANGE and \b \this returns \b HUGE_VALF. If \a x is \inf or NaN, \b \this returns \a x. If the result overflows, \b \this returns \inf. \sa ldexpf */ float scalbnf(float __x, int __exp); /*! \brief Scale a double \ingroup Exponential and logarithmic functions \synopsis \desc \b \this multiplies a floating-point number by an integral power of \b DBL_RADIX. As floating-point arithmetic conforms to IEC 60559, \b DBL_RADIX is 2 and \b \this is (in this implementation) identical to \b ldexp. \b \this returns \a x * \b DBL_RADIX^\b exp. If the result overflows, \b errno is set to \b ERANGE and \b \this returns \b HUGE_VAL. If \a x is \inf or NaN, \b \this returns \a x. \n If the result overflows, \b \this returns \inf. \sa ldexp */ double scalbn(double __x, int __exp); /*! \brief Compute natural logarithm of a float \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the base-\i e logarithm of \a x. If \a x = 0, \b errno is set to \b ERANGE and \b \this returns \minus\b HUGE_VALF. If \a x \lt 0, \b errno is set to \b EDOM and \b \this returns \minus\b HUGE_VALF. If \a x \lt 0 or \a x = \minus\inf, \b \this returns NaN. \n If \a x = 0, \b \this returns \minus\inf. \n If \a x = \inf, \b \this returns \inf. \n If \a x = NaN, \b \this returns \a x. */ float logf(float __x); /*! \brief Compute natural logarithm of a double \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the base-\i e logarithm of \a x. If \a x = 0, \b errno is set to \b ERANGE and \b log returns \minus\b HUGE_VAL. If \a x \lt 0, \b errno is set to \b EDOM and \b \this returns \minus\b HUGE_VAL. If \a x \lt 0 or \a x = \minus\inf, \b \this returns NaN. \n If \a x = 0, \b \this returns \minus\inf. \n If \a x = \inf, \b \this returns \inf. \n If \a x = NaN, \b \this returns \a x. */ double log(double __x); /*! \brief Compute common logarithm of a float \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the base-10 logarithm of \a x. If \a x = 0, \b errno is set to \b ERANGE and \b \this returns \minus\b HUGE_VALF. If \a x \lt 0, \b errno is set to \b EDOM and \b \this returns \minus\b HUGE_VALF. If \a x \lt 0 or \a x = \minus\inf, \b \this returns NaN. \n If \a x = 0, \b \this returns \minus\inf. \n If \a x = \inf, \b \this returns \inf. \n If \a x = NaN, \b \this returns \a x. */ float log10f(float __x); /*! \brief Compute common logarithm of a double \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the base-10 logarithm of \a x. If \a x = 0, \b errno is set to \b ERANGE and \b \this returns \minus\b HUGE_VAL. If \a x \lt 0, \b errno is set to \b EDOM and \b \this returns \minus\b HUGE_VAL. If \a x \lt 0 or \a x = \minus\inf, \b \this returns NaN. \n If \a x = 0, \b \this returns \minus\inf. \n If \a x = \inf, \b \this returns \inf. \n If \a x = NaN, \b \this returns \a x. */ double log10(double __x); /*! \brief Compute remainder after division of two floats \ingroup Remainder functions \synopsis \desc \b \this computes the floating-point remainder of \a x divided by \b y. \b \this returns the value \a x \minus \i n \b y, for some integer \i n such that, if \b y is nonzero, the result has the same sign as \a x and magnitude less than the magnitude of \b y. If \b y = 0, \b \this returns zero and \b errno is set to \b EDOM. \b \this (\plusminus 0, \b y) is \plusminus 0 for \b y not zero. \n \b \this (\inf, \b y) is NaN. \n \b \this (\a x, 0) is NaN. \n \b \this (x, \plusminus \inf) is \a x for \a x not infinite. \n */ float fmodf(float __x, float __y); /*! \brief Compute remainder after division of two doubles \ingroup Remainder functions \synopsis \desc \b \this computes the floating-point remainder of \a x divided by \b y. #b #this returns the value \a x \minus \i n \b y, for some integer \i n such that, if \b y is nonzero, the result has the same sign as \a x and magnitude less than the magnitude of \b y. If \b y = 0, \b \this returns zero and \b errno is set to \b EDOM. \b \this (\plusminus 0, \a y) is \plusminus 0 for \b y not zero. \n \b \this (\inf, \b y) is NaN. \n \b \this (\a x, 0) is NaN. \n \b \this (x, \plusminus \inf) is \a x for \a x not infinite. \n */ double fmod(double __x, double __y); /*! \brief Break a float into integer and fractional parts \ingroup Remainder functions \synopsis \desc \b \this breaks \a x into integral and fractional parts, each of which has the same type and sign as \a x. The integral part (in floating-point format) is stored in the object pointed to by \b iptr and \b \this returns the signed fractional part of \a x. */ float modff(float __x, float *__iptr); /*! \brief Break a double into integer and fractional parts \ingroup Remainder functions \synopsis \desc \b \this breaks \a x into integral and fractional parts, each of which has the same type and sign as \a x. The integral part (in floating-point format) is stored in the object pointed to by \b iptr and \b \this returns the signed fractional part of \a x. */ double modf(double __x, double *__iptr); /*! \brief Raise a float to a power \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes \a x raised to the power \b y. If \a x \lt 0 and \b y \le 0, \b errno. is set to \b EDOM and \b \this returns \minus\b HUGE_VALF. If \a x \le 0 and \b y is not an integer value, \b errno is set to \b EDOM and \b pow returns \minus\b HUGE_VALF. If \b y = 0, \b \this returns 1. \n If \b y = 1, \b \this returns \a x. \n If \b y = NaN, \b \this returns NaN. \n If \a x = NaN and \b y is anything other than 0, \b \this returns NaN. \n If \a x \lt \minus~1 or 1 \lt \a x, and \b y = +\inf, \b \this returns +\inf. \n If \a x \lt \minus~1 or 1 \lt \a x, and \b y = \minus\inf, \b \this returns 0. \n If \minus~1 \lt \a x \lt 1 and \b y = +\inf, \b \this returns +0. \n If \minus~1 \lt \a x \lt 1 and \b y = \minus\inf, \b \this returns +\inf. \n If \a x = +1 or \a x = \minus~1 and \b y = +\inf or \b y = \minus\inf, \b \this returns NaN. \n If \a x = +0 and \b y \gt 0 and \b y \ne NaN, \b \this returns +0. \n If \a x = \minus~0 and \b y \gt 0 and \b y \ne NaN or \b y not an odd integer, \b \this returns +0. \n If \a x = +0 and \b y \lt0 and \b y \ne NaN, \b \this returns +\inf. \n If \a x = \minus~0 and \b y \gt 0 and \b y \ne NaN or \b y not an odd integer, \b \this returns +\inf. \n If \a x = \minus~0 and \b y is an odd integer, \b \this returns \minus~0. \n If \a x = +\inf and \b y \gt 0 and \b y \ne NaN, \b \this returns +\inf. \n If \a x = +\inf and \b y \lt 0 and \b y \ne NaN, \b \this returns +0. \n If \b x = \minus\inf, \b \this returns \b \this(\minus~0, \b y) \n If \a x \lt 0 and \a x \ne \inf and \b y is a non-integer, \b \this returns NaN. \n */ float powf(float, float); /*! \brief Raise a double to a power \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes \a x raised to the power \b y. If \a x \lt 0 and \b y \le 0, \b errno is set to \b EDOM and \b \this returns \minus\b HUGE_VAL. If \a x \le 0 and \b y is not an integer value, \b errno is set to \b EDOM and \b \this returns \minus\b HUGE_VAL. If \b y = 0, \b \this returns 1. \n If \b y = 1, \b \this returns \a x. \n If \b y = NaN, \b \this returns NaN. \n If \a x = NaN and \b y is anything other than 0, \b \this returns NaN. \n If \a x \lt \minus~1 or 1 \lt \a x, and \b y = +\inf, \b \this returns +\inf. \n If \a x \lt \minus~1 or 1 \lt \a x, and \b y = \minus\inf, \b \this returns 0. \n If \minus~1 \lt \a x \lt 1 and \b y = +\inf, \b \this returns +0. \n If \minus~1 \lt \a x \lt 1 and \b y = \minus\inf, \b \this returns +\inf. \n If \a x = +1 or \a x = \minus~1 and \b y = +\inf or \b y = \minus\inf, \b \this returns NaN. \n If \a x = +0 and \b y \gt 0 and \b y \ne NaN, \b \this returns +0. \n If \a x = \minus~0 and \b y \gt 0 and \b y \ne NaN or \b y not an odd integer, \b \this returns +0. \n If \a x = +0 and \b y \lt0 and \b y \ne NaN, \b \this returns +\inf. \n If \a x = \minus~0 and \b y \gt 0 and \b y \ne NaN or \b y not an odd integer, \b \this returns +\inf. \n If \a x = \minus~0 and \b y is an odd integer, \b \this returns \minus~0. \n If \a x = +\inf and \b y \gt 0 and \b y \ne NaN, \b \this returns +\inf. \n If \a x = +\inf and \b y \lt 0 and \b y \ne NaN, \b \this returns +0. \n If \b x = \minus\inf, \b \this returns \b \this(\minus~0, \b y) \n If \a x \lt 0 and \a x \ne \inf and \b y is a non-integer, \b \this returns NaN. \n */ double pow(double __x, double __y); /*! \brief Compute square root of a float \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the nonnegative square root of \a x. C90 and C99 require that a domain error occurs if the argument is less than zero. CrossWorks C deviates and always uses IEC 60559 semantics. If \b x is +0, \b \this returns +0. \n If \b x is \minus~0, \b \this returns \minus~0. \n If \b x is \inf, \b \this returns \inf. \n If \b x \lt 0, \b \this returns NaN. \n If \b x is NaN, \b \this returns that NaN. */ float sqrtf(float __x); /*! \brief Compute square root of a double \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the nonnegative square root of \a x. C90 and C99 require that a domain error occurs if the argument is less than zero. CrossWorks C deviates and always uses IEC 60559 semantics. If \b x is +0, \b \this returns +0. \n If \b x is \minus~0, \b \this returns \minus~0. \n If \b x is \inf, \b \this returns \inf. \n If \b x \lt 0, \b \this returns NaN. \n If \b x is NaN, \b \this returns that NaN. */ double sqrt(double __x); /*! \brief Compute cube root of a float \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the cube root of \a x. */ float cbrtf(float __x); /*! \brief Compute cube root of a double \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the cube root of \a x. */ double cbrt(double __x); /*! \brief Compute smallest integer not greater than a float \ingroup Nearest integer functions \synopsis \desc \b \this computes the smallest integer value not less than \a x. \b \this (\plusminus~0) is \plusminus~0. \b \this (\plusminus \inf) is \plusminus \inf. */ float ceilf(float __x); /*! \brief Compute smallest integer not greater than a double \ingroup Nearest integer functions \synopsis \desc \b \this computes the smallest integer value not less than \a x. \b \this (\plusminus~0) is \plusminus~0. \b \this (\plusminus \inf) is \plusminus \inf. */ double ceil(double __x); /*! \brief Compute absolute value of a float \ingroup Absolute value functions \synopsis \desc \b \this computes the absolute value of the floating-point number \a x. */ float fabsf(float __x); /*! \brief Compute absolute value of a double \ingroup Absolute value functions \synopsis #desc \b \this computes the absolute value of the floating-point number \a x. */ double fabs(double __x); /*! \brief Compute minimum of two floats \ingroup Maximum, minimum, and positive difference functions \synopsis \desc \b \this determines the minimum of \a x and \b y. \b \this (NaN, \b y) is \b y. \b \this (\a x, NaN) is \a x. */ float fminf(float __x, float __y); /*! \brief Compute minimum of two doubles \ingroup Maximum, minimum, and positive difference functions \synopsis \desc \b \this determines the minimum of \a x and \b y. \b \this (NaN, \b y) is \b y. \b \this (x, NaN) is \a x. */ double fmin(double __x, double __y); /*! \brief Compute maximum of two floats \ingroup Maximum, minimum, and positive difference functions \synopsis \desc \b \this determines the maximum of \a x and \b y. \b \this (NaN, \b y) is \b y. \b \this(\a x, NaN) is \a x. */ float fmaxf(float __x, float __y); /*! \brief Compute maximum of two doubles \ingroup Maximum, minimum, and positive difference functions \synopsis \desc \b \this determines the maximum of \a x and \b y. \b \this (NaN, \b y) is \b y. \b \this (\a x, NaN) is \a x. */ double fmax(double __x, double __y); /*! \brief Compute largest integer not greater than a float \ingroup Nearest integer functions \synopsis \b \this computes the largest integer value not greater than \a x. \b \this(\plusminus~0) is \plusminus~0. \b \this(\plusminus\inf) is \plusminus\inf. */ float floorf(float); /*! \brief Compute largest integer not greater than a float \ingroup Nearest integer functions \synopsis \b \this computes the largest integer value not greater than \a x. \b \this (\plusminus~0) is \plusminus~0. \b \this (\plusminus\inf) is \plusminus\inf. */ double floor(double); /*! \brief Compute complex magnitude of two floats \ingroup Absolute value functions \synopsis \desc \b \this computes the square root of the sum of the squares of \a x and \b y, \b sqrtf(\a x*\a x + \b y*\b y), without undue overflow or underflow. If \a x and \b y are the lengths of the sides of a right-angled triangle, then \b \this computes the length of the hypotenuse. If \a x or \b y is +\inf or \minus\inf, \b \this returns \inf. If \a x or \b y is NaN, \b \this returns NaN. */ float hypotf(float __x, float __y); /*! \brief Compute complex magnitude of two doubles \ingroup Absolute value functions \synopsis \desc \b \this computes the square root of the sum of the squares of \a x and \b y, \b sqrt(\a x*\a x + \b y*\b y), without undue overflow or underflow. If \a x and \b y are the lengths of the sides of a right-angled triangle, then \b \this computes the length of the hypotenuse. If \a x or \b y is +\inf or \minus\inf, \b \this returns \inf. \n If \a x or \b y is NaN, \b \this returns NaN. */ double hypot(double __x, double __y); /*! \brief Compute hyperbolic cosine of a float \ingroup Hyperbolic functions \synopsis \desc \b \this calculates the hyperbolic sine of \a x. If |\a x| \gt ~88.7228, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. If \a x is +\inf, \minus\inf, or NaN, \b \this returns |\a x|. \n If |\a x| \gt ~88.7228, \b \this returns +\inf or \minus\inf depending upon the sign of \a x. */ float coshf(float __x); /*! \brief Compute hyperbolic cosine of a double \ingroup Hyperbolic functions \synopsis \desc \b \this calculates the hyperbolic cosine of \a x. If |\a x| \gt ~709.782, \b errno is set to \b EDOM and \b cosh returns \b HUGE_VAL. If \a x is +\inf, \minus\inf, or NaN, \b \this returns |\a x|.> If |\a x| \gt ~709.782, \b cosh returns +\inf or \minus\inf depending upon the sign of \a x. */ double cosh(double __x); /*! \brief Compute hyperbolic sine of a float \ingroup Hyperbolic functions \synopsis \desc \b \this calculates the hyperbolic sine of \a x. If |\a x| \gt ~88.7228, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. If \a x is +\inf, \minus\inf, or NaN, \b \this returns |\a x|. If |\a x| \gt ~88.7228, \b \this returns +\inf or \minus\inf depending upon the sign of \a x. */ float sinhf(float __x); /*! \brief Compute hyperbolic sine of a double \ingroup Hyperbolic functions \synopsis \desc \b \this calculates the hyperbolic sine of \a x. If |\a x| \gt709.782, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. If \a x is +\inf, \minus\inf, or NaN, \b \this returns |\a x|. If |\a x| \gt ~709.782, \b \this returns +\inf or \minus\inf depending upon the sign of \a x. */ double sinh(double __x); /*! \brief Compute hyperbolic tangent of a float \ingroup Hyperbolic functions \synopsis \desc \b \this calculates the hyperbolic tangent of \a x. If \a x is NaN, \b \this returns NaN. */ float tanhf(float __x); /*! \brief Compute hyperbolic tangent of a double \ingroup Hyperbolic functions \synopsis \desc \b \this calculates the hyperbolic tangent of \a x. If \a x is NaN, \b \this returns NaN. */ double tanh(double __x); /*! \brief Compute exponential of a float \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the base-\i e exponential of \a x. If |\a x| \gt ~88.722, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. If \a x is NaN, \b \this returns NaN. \n If \a x is \inf, \b \this returns \inf. \n If \a x is \minus\inf, \b \this returns 0. */ float expf(float __x); /*! \brief Compute exponential of a double \ingroup Exponential and logarithmic functions \synopsis \desc \b \this computes the base-\i e exponential of \a x. If |\a x| \gt ~709.782, \b errno is set to \b EDOM and \b exp returns \b HUGE_VAL. If \a x is NaN, \b exp returns NaN. \n If \a x is \inf, \b \this returns \inf. \n If \a x is \minus\inf, \b \this returns 0. */ double exp(double __x); /*! \brief Compute inverse hyperbolic cosine of a float \ingroup Inverse hyperbolic functions \synopsis \desc \b \this returns the non-negative inverse hyperbolic cosine of \a x. \b acosh(\i x) is defined as \b log(\i x + \b sqrt(\i x^2 \minus 1)), assuming completely accurate computation. If \a x \lt 1, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. If \a x \lt 1, \b \this returns NaN. \n If \a x is NaN, \b \this returns that NaN. */ float acoshf(float __x); /*! \brief Compute inverse hyperbolic cosine of a double \ingroup Inverse hyperbolic functions \synopsis \desc \b \this returns the non-negative inverse hyperbolic cosine of \a x. \b acosh(\i x) is defined as \b log(\i x + \b sqrt(\i x^2 \minus 1)), assuming completely accurate computation. If \a x \lt 1, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. If \a x \lt 1, \b \this returns NaN. \n If \a x is NaN, \b \this returns NaN. */ double acosh(double __x); /*! \brief Compute inverse hyperbolic sine of a float \ingroup Inverse hyperbolic functions \synopsis \desc \b \this calculates the hyperbolic sine of \a x. If |\a x| \gt ~88.7228, \b errnois set to \b EDOM and \b \this returns \b HUGE_VALF. If \a x is +\inf, \minus\inf, or NaN, \b \this returns |\a x|. If |\a x| \gt ~88.7228, \b \this returns +\inf or \minus\inf depending upon the sign of \a x. */ float asinhf(float __x); /*! \brief Compute inverse hyperbolic sine of a double \ingroup Inverse hyperbolic functions \synopsis \desc \b \this calculates the hyperbolic sine of \a x. If |\a x| \gt ~709.782, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. If \a x is +\inf, \minus\inf, or NaN, \b \this returns |\a x|. If |\a x| \gt ~709.782, \b \this returns +\inf or \minus\inf depending upon the sign of \a x. */ double asinh(double __x); /*! \brief Compute inverse hyperbolic tangent of a float \ingroup Inverse hyperbolic functions \synopsis \desc \b \this returns the inverse hyperbolic tangent of \b val. If |\a x| \ge 1, \b errno is set to \b EDOM and \b \this returns \b HUGE_VALF. If |\b val| \gt 1 \b \this returns NaN. If \b val is NaN, \b \this returns that NaN. If \b val is 1, \b \this returns \inf. If \b val is \minus~1, \b \this returns \minus\inf. */ float atanhf(float __x); /*! \brief Compute inverse hyperbolic tangent of a double \ingroup Inverse hyperbolic functions \synopsis \desc \b \this returns the inverse hyperbolic tangent of \a x. If |\a x| \ge 1, \b errno is set to \b EDOM and \b \this returns \b HUGE_VAL. If |\a x| \gt 1 \b \this returns NaN. \n If \a x is NaN, \b \this returns that NaN. \n If \a x is 1, \b \this returns \inf. \n If \a x is \minus~1, \b \this returns \minus\inf. */ double atanh(double __x); #ifndef __NO_PRIVATE_PROTOTYPES /* Private functions. */ int __float32_isinf(float); int __float64_isinf(double); int __float32_isnan(float); int __float64_isnan(double); int __float32_isfinite(float); int __float64_isfinite(double); int __float32_isnormal(float); int __float64_isnormal(double); int __float32_signbit(float); int __float64_signbit(double); int __float32_classify(float); int __float64_classify(double); #endif #ifdef __cplusplus } #endif #endif #endif