123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- /*
- * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- #pragma once
- #include <float.h>
- #include <limits.h>
- #include <sys/cdefs.h>
- #if __cplusplus >= 201103L
- # define NOEXCEPT noexcept
- #else
- # define NOEXCEPT
- #endif
- __BEGIN_DECLS
- #define MATH_ERRNO 1
- #define MATH_ERREXCEPT 2
- #define math_errhandling MATH_ERREXCEPT
- #define HUGE_VALF __builtin_huge_valf()
- #define HUGE_VAL __builtin_huge_val()
- #define HUGE_VALL __builtin_huge_vall()
- #define INFINITY __builtin_huge_val()
- #define NAN __builtin_nan("")
- #define MAXFLOAT FLT_MAX
- #define M_E 2.718281828459045
- #define M_PI 3.141592653589793
- #define M_PI_2 1.570796326794896
- #define M_TAU 6.283185307179586
- #define M_DEG2RAD 0.017453292519943
- #define M_RAD2DEG 57.29577951308232
- #define M_LN2 0.69314718055995
- #define M_LN10 2.30258509299405
- #define M_SQRT2 1.4142135623730951
- #define M_SQRT1_2 0.7071067811865475
- #define FP_NAN 0
- #define FP_INFINITE 1
- #define FP_ZERO 2
- #define FP_SUBNORMAL 3
- #define FP_NORMAL 4
- #define fpclassify(x) __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_ZERO, FP_SUBNORMAL, FP_ZERO, x)
- #define signbit(x) __builtin_signbit(x)
- #define isnan(x) __builtin_isnan(x)
- #define isinf(x) __builtin_isinf_sign(x)
- #define isfinite(x) __builtin_isfinite(x)
- #define isnormal(x) __builtin_isnormal(x)
- #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_isunoredered((x), (y))
- #define DOUBLE_MAX ((double)0b0111111111101111111111111111111111111111111111111111111111111111)
- #define DOUBLE_MIN ((double)0b0000000000010000000000000000000000000000000000000000000000000000)
- #define FP_ILOGB0 INT_MIN
- #define FP_ILOGNAN INT_MAX
- #define FLT_EVAL_METHOD __FLT_EVAL_METHOD__
- #if FLT_EVAL_METHOD == 0
- typedef float float_t;
- typedef double double_t;
- #elif FLT_EVAL_METHOD == 1
- typedef double float_t;
- typedef double double_t;
- #elif FLT_EVAL_METHOD == 2
- typedef long double float_t;
- typedef long double double_t;
- #else
- typedef float float_t;
- typedef double double_t;
- #endif
- /* Basic floating point operations */
- long double fabsl(long double) NOEXCEPT;
- double fabs(double) NOEXCEPT;
- float fabsf(float) NOEXCEPT;
- long double fmodl(long double, long double) NOEXCEPT;
- double fmod(double, double) NOEXCEPT;
- float fmodf(float, float) NOEXCEPT;
- long double fmaxl(long double, long double) NOEXCEPT;
- double fmax(double, double) NOEXCEPT;
- float fmaxf(float, float) NOEXCEPT;
- long double fminl(long double, long double) NOEXCEPT;
- double fmin(double, double) NOEXCEPT;
- float fminf(float, float) NOEXCEPT;
- long double remainderl(long double, long double) NOEXCEPT;
- double remainder(double, double) NOEXCEPT;
- float remainderf(float, float) NOEXCEPT;
- long double nanl(const char*) NOEXCEPT;
- double nan(const char*) NOEXCEPT;
- float nanf(const char*) NOEXCEPT;
- /* Exponential functions */
- long double expl(long double) NOEXCEPT;
- double exp(double) NOEXCEPT;
- float expf(float) NOEXCEPT;
- long double exp2l(long double) NOEXCEPT;
- double exp2(double) NOEXCEPT;
- float exp2f(float) NOEXCEPT;
- long double expm1l(long double) NOEXCEPT;
- double expm1(double) NOEXCEPT;
- float expm1f(float) NOEXCEPT;
- long double logl(long double) NOEXCEPT;
- double log(double) NOEXCEPT;
- float logf(float) NOEXCEPT;
- double log2(double) NOEXCEPT;
- float log2f(float) NOEXCEPT;
- long double log2l(long double) NOEXCEPT;
- long double log10l(long double) NOEXCEPT;
- double log10(double) NOEXCEPT;
- float log10f(float) NOEXCEPT;
- long double log1pl(long double) NOEXCEPT;
- double log1p(double) NOEXCEPT;
- float log1pf(float) NOEXCEPT;
- /* Power functions */
- long double powl(long double x, long double y) NOEXCEPT;
- double pow(double x, double y) NOEXCEPT;
- float powf(float x, float y) NOEXCEPT;
- long double sqrtl(long double) NOEXCEPT;
- double sqrt(double) NOEXCEPT;
- float sqrtf(float) NOEXCEPT;
- long double cbrtl(long double) NOEXCEPT;
- double cbrt(double) NOEXCEPT;
- float cbrtf(float) NOEXCEPT;
- long double hypotl(long double, long double) NOEXCEPT;
- double hypot(double, double) NOEXCEPT;
- float hypotf(float, float) NOEXCEPT;
- /* Trigonometric functions */
- long double sinl(long double) NOEXCEPT;
- double sin(double) NOEXCEPT;
- float sinf(float) NOEXCEPT;
- long double cosl(long double) NOEXCEPT;
- double cos(double) NOEXCEPT;
- float cosf(float) NOEXCEPT;
- long double tanl(long double) NOEXCEPT;
- double tan(double) NOEXCEPT;
- float tanf(float) NOEXCEPT;
- long double asinl(long double) NOEXCEPT;
- double asin(double) NOEXCEPT;
- float asinf(float) NOEXCEPT;
- long double acosl(long double) NOEXCEPT;
- double acos(double) NOEXCEPT;
- float acosf(float) NOEXCEPT;
- long double atanl(long double) NOEXCEPT;
- double atan(double) NOEXCEPT;
- float atanf(float) NOEXCEPT;
- long double atan2l(long double, long double) NOEXCEPT;
- double atan2(double, double) NOEXCEPT;
- float atan2f(float, float) NOEXCEPT;
- /* Hyperbolic functions*/
- long double sinhl(long double) NOEXCEPT;
- double sinh(double) NOEXCEPT;
- float sinhf(float) NOEXCEPT;
- long double coshl(long double) NOEXCEPT;
- double cosh(double) NOEXCEPT;
- float coshf(float) NOEXCEPT;
- long double tanhl(long double) NOEXCEPT;
- double tanh(double) NOEXCEPT;
- float tanhf(float) NOEXCEPT;
- long double asinhl(long double) NOEXCEPT;
- double asinh(double) NOEXCEPT;
- float asinhf(float) NOEXCEPT;
- long double acoshl(long double) NOEXCEPT;
- double acosh(double) NOEXCEPT;
- float acoshf(float) NOEXCEPT;
- long double atanhl(long double) NOEXCEPT;
- double atanh(double) NOEXCEPT;
- float atanhf(float) NOEXCEPT;
- /* Error and gamma functions */
- long double erfl(long double) NOEXCEPT;
- double erf(double) NOEXCEPT;
- float erff(float) NOEXCEPT;
- long double erfcl(long double) NOEXCEPT;
- double erfc(double) NOEXCEPT;
- float erfcf(float) NOEXCEPT;
- double gamma(double) NOEXCEPT;
- long double tgammal(long double) NOEXCEPT;
- double tgamma(double) NOEXCEPT;
- float tgammaf(float) NOEXCEPT;
- long double lgammal(long double) NOEXCEPT;
- double lgamma(double) NOEXCEPT;
- float lgammaf(float) NOEXCEPT;
- long double lgammal_r(long double, int*) NOEXCEPT;
- double lgamma_r(double, int*) NOEXCEPT;
- float lgammaf_r(float, int*) NOEXCEPT;
- extern int signgam;
- /* Nearest integer floating point operations */
- long double ceill(long double) NOEXCEPT;
- double ceil(double) NOEXCEPT;
- float ceilf(float) NOEXCEPT;
- long double floorl(long double) NOEXCEPT;
- double floor(double) NOEXCEPT;
- float floorf(float) NOEXCEPT;
- long double truncl(long double) NOEXCEPT;
- double trunc(double) NOEXCEPT;
- float truncf(float) NOEXCEPT;
- float roundf(float) NOEXCEPT;
- double round(double) NOEXCEPT;
- long double roundl(long double) NOEXCEPT;
- long lroundf(float) NOEXCEPT;
- long lround(double) NOEXCEPT;
- long lroundl(long double) NOEXCEPT;
- long long llroundf(float) NOEXCEPT;
- long long llround(double) NOEXCEPT;
- long long llroundd(long double) NOEXCEPT;
- float rintf(float) NOEXCEPT;
- double rint(double) NOEXCEPT;
- long double rintl(long double) NOEXCEPT;
- long lrintl(long double) NOEXCEPT;
- long lrint(double) NOEXCEPT;
- long lrintf(float) NOEXCEPT;
- long long llrintl(long double) NOEXCEPT;
- long long llrint(double) NOEXCEPT;
- long long llrintf(float) NOEXCEPT;
- /* Floating point manipulation functions */
- long double frexpl(long double, int* exp) NOEXCEPT;
- double frexp(double, int* exp) NOEXCEPT;
- float frexpf(float, int* exp) NOEXCEPT;
- long double ldexpl(long double, int exp) NOEXCEPT;
- double ldexp(double, int exp) NOEXCEPT;
- float ldexpf(float, int exp) NOEXCEPT;
- long double modfl(long double, long double*) NOEXCEPT;
- double modf(double, double*) NOEXCEPT;
- float modff(float, float*) NOEXCEPT;
- float scalbnf(float, int) NOEXCEPT;
- double scalbn(double, int) NOEXCEPT;
- long double scalbnl(long double, int) NOEXCEPT;
- float scalbnlf(float, long) NOEXCEPT;
- double scalbln(double, long) NOEXCEPT;
- long double scalblnl(long double, long) NOEXCEPT;
- int ilogbl(long double) NOEXCEPT;
- int ilogb(double) NOEXCEPT;
- int ilogbf(float) NOEXCEPT;
- long double logbl(long double) NOEXCEPT;
- double logb(double) NOEXCEPT;
- float logbf(float) NOEXCEPT;
- double nextafter(double, double) NOEXCEPT;
- float nextafterf(float, float) NOEXCEPT;
- long double nextafterl(long double, long double) NOEXCEPT;
- double nexttoward(double, long double) NOEXCEPT;
- float nexttowardf(float, long double) NOEXCEPT;
- long double nexttowardl(long double, long double) NOEXCEPT;
- float copysignf(float x, float y) NOEXCEPT;
- double copysign(double x, double y) NOEXCEPT;
- long double copysignl(long double x, long double y) NOEXCEPT;
- __END_DECLS
|