PatchworkOS
Loading...
Searching...
No Matches
math.h File Reference
#include "_internal/config.h"

Go to the source code of this file.

Macros

#define M_PI   3.14159265358979323846
 
#define M_PI_2   1.57079632679489661923
 
#define M_PI_4   0.78539816339744830962
 
#define HUGE_VALF   (1.0f / 0.0f)
 
#define HUGE_VAL   (1.0 / 0.0)
 
#define HUGE_VALL   (1.0L / 0.0L)
 
#define INFINITY   (1.0f / 0.0f)
 
#define NAN   (-(0.0f / 0.0f))
 
#define FP_ILOGB0   INT_MIN
 
#define FP_ILOGBNAN   INT_MAX
 
#define MATH_ERRNO   1
 
#define MATH_ERREXCEPT   2
 
#define math_errhandling   (MATH_ERRNO)
 
#define isfinite(x)   __builtin_isfinite(x)
 
#define isinf(x)   __builtin_isinf(x)
 
#define isnan(x)   __builtin_isnan(x)
 
#define isnormal(x)   __builtin_isnormal(x)
 
#define signbit(x)   __builtin_signbit(x)
 
#define fpclassify(x)   __builtin_fpclassify(FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, 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_isunordered(x, y)
 
#define FP_INFINITE   1
 
#define FP_NAN   2
 
#define FP_NORMAL   3
 
#define FP_SUBNORMAL   4
 
#define FP_ZERO   5
 

Functions

double acos (double x)
 
float acosf (float x)
 
long double acosl (long double x)
 
double asin (double x)
 
float asinf (float x)
 
long double asinl (long double x)
 
double atan (double x)
 
float atanf (float x)
 
long double atanl (long double x)
 
double atan2 (double y, double x)
 
float atan2f (float y, float x)
 
long double atan2l (long double y, long double x)
 
double cos (double x)
 
float cosf (float x)
 
long double cosl (long double x)
 
double sin (double x)
 
float sinf (float x)
 
long double sinl (long double x)
 
double tan (double x)
 
float tanf (float x)
 
long double tanl (long double x)
 
double acosh (double x)
 
float acoshf (float x)
 
long double acoshl (long double x)
 
double asinh (double x)
 
float asinhf (float x)
 
long double asinhl (long double x)
 
double atanh (double x)
 
float atanhf (float x)
 
long double atanhl (long double x)
 
double cosh (double x)
 
float coshf (float x)
 
long double coshl (long double x)
 
double sinh (double x)
 
float sinhf (float x)
 
long double sinhl (long double x)
 
double tanh (double x)
 
float tanhf (float x)
 
long double tanhl (long double x)
 
double exp (double x)
 
float expf (float x)
 
long double expl (long double x)
 
double exp2 (double x)
 
float exp2f (float x)
 
long double exp2l (long double x)
 
double expm1 (double x)
 
float expm1f (float x)
 
long double expm1l (long double x)
 
double frexp (double value, int *exp)
 
float frexpf (float value, int *exp)
 
long double frexpl (long double value, int *exp)
 
double ilogb (double x)
 
float ilogbf (float x)
 
long double ilogbl (long double x)
 
double ldexp (double x, int exp)
 
float ldexpf (float x, int exp)
 
long double ldexpl (long double x, int exp)
 
double log (double x)
 
float logf (float x)
 
long double logl (long double x)
 
double log10 (double x)
 
float log10f (float x)
 
long double log10l (long double x)
 
double log1p (double x)
 
float log1pf (float x)
 
long double log1pl (long double x)
 
double log2 (double x)
 
float log2f (float x)
 
long double log2l (long double x)
 
double logb (double x)
 
float logbf (float x)
 
long double logbl (long double x)
 
double modf (double value, double *iptr)
 
float modff (float value, float *iptr)
 
long double modfl (long double value, long double *iptr)
 
double scalbn (double x, int n)
 
float scalbnf (float x, int n)
 
long double scalbnl (long double x, int n)
 
double scalbln (double x, long int *n)
 
float scalblnf (float x, long int *n)
 
long double scalblnl (long double x, long int *n)
 
double cbrt (double x)
 
float cbrtf (float x)
 
long double cbrtl (long double x)
 
double fabs (double x)
 
float fabsf (float x)
 
long double fabsl (long double x)
 
double hypot (double x, double y)
 
float hypotf (float x, float y)
 
long double hypotl (long double x, long double y)
 
double pow (double x, double y)
 
float powf (float x, float y)
 
long double powl (long double x, long double y)
 
double sqrt (double x)
 
float sqrtf (float x)
 
long double sqrtl (long double x)
 
double erf (double x)
 
float erff (float x)
 
long double erfl (long double x)
 
double erfc (double x)
 
float erfcf (float x)
 
long double erfcl (long double x)
 
double lgamma (double x)
 
float lgammaf (float x)
 
long double lgammal (long double x)
 
double tgamma (double x)
 
float tgammaf (float x)
 
long double tgammal (long double x)
 
double ceil (double x)
 
float ceilf (float x)
 
long double ceill (long double x)
 
double floor (double x)
 
float floorf (float x)
 
long double floorl (long double x)
 
double nearbyint (double x)
 
float nearbyintf (float x)
 
long double nearbyintl (long double x)
 
double rint (double x)
 
float rintf (float x)
 
long double rintl (long double x)
 
long int lrint (double x)
 
long int lrintf (float x)
 
long int lrintl (long double x)
 
long long int llrint (double x)
 
long long int llrintf (float x)
 
long long int llrintl (long double x)
 
double round (double x)
 
float roundf (float x)
 
long double roundl (long double x)
 
long int lround (double x)
 
long int lroundf (float x)
 
long int lroundl (long double x)
 
long long int llround (double x)
 
long long int llroundf (float x)
 
long long int llroundl (long double x)
 
double trunc (double x)
 
float truncf (float x)
 
long double truncl (long double x)
 
double fmod (double x, double y)
 
float fmodf (float x, float y)
 
long double fmodl (long double x, long double y)
 
double remainder (double x, double y)
 
float remainderf (float x, float y)
 
long double remainderl (long double x, long double y)
 
double rmquo (double x, double y)
 
float rmquof (float x, float y)
 
long double rmquol (long double x, long double y)
 
double copysign (double x, double y)
 
float copysignf (float x, float y)
 
long double copysignl (long double x, long double y)
 
double nan (const char *tagp)
 
float nanf (const char *tagp)
 
long double nanl (const char *tagp)
 
double nextafter (double x, double y)
 
float nextafterf (float x, float y)
 
long double nextafterl (long double x, long double y)
 
double nexttoward (double x, double y)
 
float nexttowardf (float x, float y)
 
long double nexttowardl (long double x, long double y)
 
double fdim (double x, double y)
 
float fdimf (float x, float y)
 
long double fdiml (long double x, long double y)
 
double fmax (double x, double y)
 
float fmaxf (float x, float y)
 
long double fmaxl (long double x, long double y)
 
double fmin (double x, double y)
 
float fminf (float x, float y)
 
long double fminl (long double x, long double y)
 
double fma (double x, double y, double z)
 
float fmaf (float x, float y, float z)
 
long double fmal (long double x, long double y, long double z)
 

Macro Definition Documentation

◆ FP_ILOGB0

#define FP_ILOGB0   INT_MIN

Definition at line 26 of file math.h.

◆ FP_ILOGBNAN

#define FP_ILOGBNAN   INT_MAX

Definition at line 27 of file math.h.

◆ FP_INFINITE

#define FP_INFINITE   1

Definition at line 59 of file math.h.

◆ FP_NAN

#define FP_NAN   2

Definition at line 60 of file math.h.

◆ FP_NORMAL

#define FP_NORMAL   3

Definition at line 61 of file math.h.

◆ FP_SUBNORMAL

#define FP_SUBNORMAL   4

Definition at line 62 of file math.h.

◆ FP_ZERO

#define FP_ZERO   5

Definition at line 63 of file math.h.

◆ fpclassify

#define fpclassify (   x)    __builtin_fpclassify(FP_INFINITE, FP_NAN, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)

Definition at line 45 of file math.h.

◆ HUGE_VAL

#define HUGE_VAL   (1.0 / 0.0)

Definition at line 16 of file math.h.

◆ HUGE_VALF

#define HUGE_VALF   (1.0f / 0.0f)

Definition at line 15 of file math.h.

◆ HUGE_VALL

#define HUGE_VALL   (1.0L / 0.0L)

Definition at line 17 of file math.h.

◆ INFINITY

#define INFINITY   (1.0f / 0.0f)

Definition at line 19 of file math.h.

◆ isfinite

#define isfinite (   x)    __builtin_isfinite(x)

Definition at line 35 of file math.h.

◆ isgreater

#define isgreater (   x,
  y 
)    __builtin_isgreater(x, y)

Definition at line 47 of file math.h.

◆ isgreaterequal

#define isgreaterequal (   x,
  y 
)    __builtin_isgreaterequal(x, y)

Definition at line 49 of file math.h.

◆ isinf

#define isinf (   x)    __builtin_isinf(x)

Definition at line 37 of file math.h.

◆ isless

#define isless (   x,
  y 
)    __builtin_isless(x, y)

Definition at line 51 of file math.h.

◆ islessequal

#define islessequal (   x,
  y 
)    __builtin_islessequal(x, y)

Definition at line 53 of file math.h.

◆ islessgreater

#define islessgreater (   x,
  y 
)    __builtin_islessgreater(x, y)

Definition at line 55 of file math.h.

◆ isnan

#define isnan (   x)    __builtin_isnan(x)

Definition at line 39 of file math.h.

◆ isnormal

#define isnormal (   x)    __builtin_isnormal(x)

Definition at line 41 of file math.h.

◆ isunordered

#define isunordered (   x,
  y 
)    __builtin_isunordered(x, y)

Definition at line 57 of file math.h.

◆ M_PI

#define M_PI   3.14159265358979323846

Definition at line 11 of file math.h.

◆ M_PI_2

#define M_PI_2   1.57079632679489661923

Definition at line 12 of file math.h.

◆ M_PI_4

#define M_PI_4   0.78539816339744830962

Definition at line 13 of file math.h.

◆ MATH_ERREXCEPT

#define MATH_ERREXCEPT   2

Definition at line 30 of file math.h.

◆ math_errhandling

#define math_errhandling   (MATH_ERRNO)

Definition at line 33 of file math.h.

◆ MATH_ERRNO

#define MATH_ERRNO   1

Definition at line 29 of file math.h.

◆ NAN

#define NAN   (-(0.0f / 0.0f))

Definition at line 20 of file math.h.

◆ signbit

#define signbit (   x)    __builtin_signbit(x)

Definition at line 43 of file math.h.

Function Documentation

◆ acos()

double acos ( double  x)

◆ acosf()

float acosf ( float  x)

◆ acosh()

double acosh ( double  x)

◆ acoshf()

float acoshf ( float  x)

◆ acoshl()

long double acoshl ( long double  x)

◆ acosl()

long double acosl ( long double  x)

◆ asin()

double asin ( double  x)

◆ asinf()

float asinf ( float  x)

◆ asinh()

double asinh ( double  x)

◆ asinhf()

float asinhf ( float  x)

◆ asinhl()

long double asinhl ( long double  x)

◆ asinl()

long double asinl ( long double  x)

◆ atan()

double atan ( double  x)

Definition at line 5 of file atan.c.

References fabs(), isinf, isnan, M_PI_2, NAN, and x.

Referenced by atan2().

◆ atan2()

double atan2 ( double  y,
double  x 
)

Definition at line 4 of file atan2.c.

References atan(), fabs(), isinf, isnan, M_PI, M_PI_2, M_PI_4, NAN, x, and y.

Referenced by draw_line().

◆ atan2f()

float atan2f ( float  y,
float  x 
)

◆ atan2l()

long double atan2l ( long double  y,
long double  x 
)

◆ atanf()

float atanf ( float  x)

◆ atanh()

double atanh ( double  x)

◆ atanhf()

float atanhf ( float  x)

◆ atanhl()

long double atanhl ( long double  x)

◆ atanl()

long double atanl ( long double  x)

◆ cbrt()

double cbrt ( double  x)

◆ cbrtf()

float cbrtf ( float  x)

◆ cbrtl()

long double cbrtl ( long double  x)

◆ ceil()

double ceil ( double  x)

Definition at line 5 of file ceil.c.

References fabs(), INT64_MAX, isinf, isnan, NAN, and x.

Referenced by modf(), and trunc().

◆ ceilf()

float ceilf ( float  x)

◆ ceill()

long double ceill ( long double  x)

◆ copysign()

double copysign ( double  x,
double  y 
)

◆ copysignf()

float copysignf ( float  x,
float  y 
)

◆ copysignl()

long double copysignl ( long double  x,
long double  y 
)

◆ cos()

double cos ( double  x)

Definition at line 6 of file cos.c.

References EDOM, errno, isinf, isnan, NAN, and x.

Referenced by draw_line(), and polygon_rotate().

◆ cosf()

float cosf ( float  x)

◆ cosh()

double cosh ( double  x)

◆ coshf()

float coshf ( float  x)

◆ coshl()

long double coshl ( long double  x)

◆ cosl()

long double cosl ( long double  x)

◆ erf()

double erf ( double  x)

◆ erfc()

double erfc ( double  x)

◆ erfcf()

float erfcf ( float  x)

◆ erfcl()

long double erfcl ( long double  x)

◆ erff()

float erff ( float  x)

◆ erfl()

long double erfl ( long double  x)

◆ exp()

double exp ( double  x)

◆ exp2()

double exp2 ( double  x)

◆ exp2f()

float exp2f ( float  x)

◆ exp2l()

long double exp2l ( long double  x)

◆ expf()

float expf ( float  x)

◆ expl()

long double expl ( long double  x)

◆ expm1()

double expm1 ( double  x)

◆ expm1f()

float expm1f ( float  x)

◆ expm1l()

long double expm1l ( long double  x)

◆ fabs()

double fabs ( double  x)

Definition at line 3 of file fabs.c.

Referenced by atan(), atan2(), ceil(), floor(), and round().

◆ fabsf()

float fabsf ( float  x)

◆ fabsl()

long double fabsl ( long double  x)

◆ fdim()

double fdim ( double  x,
double  y 
)

◆ fdimf()

float fdimf ( float  x,
float  y 
)

◆ fdiml()

long double fdiml ( long double  x,
long double  y 
)

◆ floor()

double floor ( double  x)

Definition at line 4 of file floor.c.

References fabs(), INT64_MAX, isinf, isnan, NAN, and x.

Referenced by modf(), and trunc().

◆ floorf()

float floorf ( float  x)

◆ floorl()

long double floorl ( long double  x)

◆ fma()

double fma ( double  x,
double  y,
double  z 
)

◆ fmaf()

float fmaf ( float  x,
float  y,
float  z 
)

◆ fmal()

long double fmal ( long double  x,
long double  y,
long double  z 
)

◆ fmax()

double fmax ( double  x,
double  y 
)

◆ fmaxf()

float fmaxf ( float  x,
float  y 
)

◆ fmaxl()

long double fmaxl ( long double  x,
long double  y 
)

◆ fmin()

double fmin ( double  x,
double  y 
)

◆ fminf()

float fminf ( float  x,
float  y 
)

◆ fminl()

long double fminl ( long double  x,
long double  y 
)

◆ fmod()

double fmod ( double  x,
double  y 
)

Definition at line 5 of file fmod.c.

References EDOM, errno, isinf, isnan, NAN, trunc(), x, and y.

Referenced by round().

◆ fmodf()

float fmodf ( float  x,
float  y 
)

◆ fmodl()

long double fmodl ( long double  x,
long double  y 
)

◆ frexp()

double frexp ( double  value,
int *  exp 
)

◆ frexpf()

float frexpf ( float  value,
int *  exp 
)

◆ frexpl()

long double frexpl ( long double  value,
int *  exp 
)

◆ hypot()

double hypot ( double  x,
double  y 
)

◆ hypotf()

float hypotf ( float  x,
float  y 
)

◆ hypotl()

long double hypotl ( long double  x,
long double  y 
)

◆ ilogb()

double ilogb ( double  x)

◆ ilogbf()

float ilogbf ( float  x)

◆ ilogbl()

long double ilogbl ( long double  x)

◆ ldexp()

double ldexp ( double  x,
int  exp 
)

◆ ldexpf()

float ldexpf ( float  x,
int  exp 
)

◆ ldexpl()

long double ldexpl ( long double  x,
int  exp 
)

◆ lgamma()

double lgamma ( double  x)

◆ lgammaf()

float lgammaf ( float  x)

◆ lgammal()

long double lgammal ( long double  x)

◆ llrint()

long long int llrint ( double  x)

◆ llrintf()

long long int llrintf ( float  x)

◆ llrintl()

long long int llrintl ( long double  x)

◆ llround()

long long int llround ( double  x)

◆ llroundf()

long long int llroundf ( float  x)

◆ llroundl()

long long int llroundl ( long double  x)

◆ log()

double log ( double  x)

◆ log10()

double log10 ( double  x)

◆ log10f()

float log10f ( float  x)

◆ log10l()

long double log10l ( long double  x)

◆ log1p()

double log1p ( double  x)

◆ log1pf()

float log1pf ( float  x)

◆ log1pl()

long double log1pl ( long double  x)

◆ log2()

double log2 ( double  x)

◆ log2f()

float log2f ( float  x)

◆ log2l()

long double log2l ( long double  x)

◆ logb()

double logb ( double  x)

◆ logbf()

float logbf ( float  x)

◆ logbl()

long double logbl ( long double  x)

◆ logf()

float logf ( float  x)

◆ logl()

long double logl ( long double  x)

◆ lrint()

long int lrint ( double  x)

◆ lrintf()

long int lrintf ( float  x)

◆ lrintl()

long int lrintl ( long double  x)

◆ lround()

long int lround ( double  x)

◆ lroundf()

long int lroundf ( float  x)

◆ lroundl()

long int lroundl ( long double  x)

◆ modf()

double modf ( double  value,
double *  iptr 
)

Definition at line 5 of file modf.c.

References ceil(), floor(), INFINITY, isinf, isnan, NAN, and x.

Referenced by round().

◆ modff()

float modff ( float  value,
float *  iptr 
)

◆ modfl()

long double modfl ( long double  value,
long double *  iptr 
)

◆ nan()

double nan ( const char *  tagp)

◆ nanf()

float nanf ( const char *  tagp)

◆ nanl()

long double nanl ( const char *  tagp)

◆ nearbyint()

double nearbyint ( double  x)

◆ nearbyintf()

float nearbyintf ( float  x)

◆ nearbyintl()

long double nearbyintl ( long double  x)

◆ nextafter()

double nextafter ( double  x,
double  y 
)

◆ nextafterf()

float nextafterf ( float  x,
float  y 
)

◆ nextafterl()

long double nextafterl ( long double  x,
long double  y 
)

◆ nexttoward()

double nexttoward ( double  x,
double  y 
)

◆ nexttowardf()

float nexttowardf ( float  x,
float  y 
)

◆ nexttowardl()

long double nexttowardl ( long double  x,
long double  y 
)

◆ pow()

double pow ( double  x,
double  y 
)

◆ powf()

float powf ( float  x,
float  y 
)

◆ powl()

long double powl ( long double  x,
long double  y 
)

◆ remainder()

double remainder ( double  x,
double  y 
)

Referenced by _heap_block_split(), lltoa(), and realloc().

◆ remainderf()

float remainderf ( float  x,
float  y 
)

◆ remainderl()

long double remainderl ( long double  x,
long double  y 
)

◆ rint()

double rint ( double  x)

◆ rintf()

float rintf ( float  x)

◆ rintl()

long double rintl ( long double  x)

◆ rmquo()

double rmquo ( double  x,
double  y 
)

◆ rmquof()

float rmquof ( float  x,
float  y 
)

◆ rmquol()

long double rmquol ( long double  x,
long double  y 
)

◆ round()

double round ( double  x)

Definition at line 4 of file round.c.

References fabs(), fmod(), isinf, isnan, modf(), NAN, and x.

Referenced by polygon_rotate().

◆ roundf()

float roundf ( float  x)

◆ roundl()

long double roundl ( long double  x)

◆ scalbln()

double scalbln ( double  x,
long int *  n 
)

◆ scalblnf()

float scalblnf ( float  x,
long int *  n 
)

◆ scalblnl()

long double scalblnl ( long double  x,
long int *  n 
)

◆ scalbn()

double scalbn ( double  x,
int  n 
)

◆ scalbnf()

float scalbnf ( float  x,
int  n 
)

◆ scalbnl()

long double scalbnl ( long double  x,
int  n 
)

◆ sin()

double sin ( double  x)

Definition at line 6 of file sin.c.

References EDOM, errno, isinf, isnan, NAN, and x.

Referenced by draw_line(), and polygon_rotate().

◆ sinf()

float sinf ( float  x)

◆ sinh()

double sinh ( double  x)

◆ sinhf()

float sinhf ( float  x)

◆ sinhl()

long double sinhl ( long double  x)

◆ sinl()

long double sinl ( long double  x)

◆ sqrt()

double sqrt ( double  x)

◆ sqrtf()

float sqrtf ( float  x)

◆ sqrtl()

long double sqrtl ( long double  x)

◆ tan()

double tan ( double  x)

◆ tanf()

float tanf ( float  x)

◆ tanh()

double tanh ( double  x)

◆ tanhf()

float tanhf ( float  x)

◆ tanhl()

long double tanhl ( long double  x)

◆ tanl()

long double tanl ( long double  x)

◆ tgamma()

double tgamma ( double  x)

◆ tgammaf()

float tgammaf ( float  x)

◆ tgammal()

long double tgammal ( long double  x)

◆ trunc()

double trunc ( double  x)

Definition at line 3 of file trunc.c.

References ceil(), floor(), isinf, isnan, NAN, and x.

Referenced by fmod().

◆ truncf()

float truncf ( float  x)

◆ truncl()

long double truncl ( long double  x)