math.h(3avr)
β¨ NAME β¨
math.h β bestie, it's the math header for AVR-LibC π
You asked for the math.h page from the 3avr manual? Slay, here it is. It's not a chatty page ngl β no long DESCRIPTION, no OPTIONS, no RETURN VALUES, no ERRORS, nothing dramatic like that. It's literally just the roster: every macro and every function declaration this header brings to the group chat. And we're listing every single one, no cap. π«Ά
πΈ SYNOPSIS πΈ
π Macros π
okay so first up, the macros. These are the constants, and their values are exact β copy them character for character or don't copy them at all, iykyk:
#define M_E 2.7182818284590452354
#define M_LOG2E 1.4426950408889634074
#define M_LOG10E 0.43429448190325182765
#define M_LN2 0.69314718055994530942
#define M_LN10 2.30258509299404568402
#define M_PI 3.14159265358979323846
#define M_PI_2 1.57079632679489661923
#define M_PI_4 0.78539816339744830962
#define M_1_PI 0.31830988618379067154
#define M_2_PI 0.63661977236758134308
#define M_2_SQRTPI 1.12837916709551257390
#define M_SQRT2 1.41421356237309504880
#define M_SQRT1_2 0.70710678118654752440
#define NAN __builtin_nan('')
#define nanf(__tagp)
#define nan(__tag)
#define nanl(__tag)
#define INFINITY __builtin_inf()
#define HUGE_VALF __builtin_huge_valf()
#define HUGE_VAL __builtin_huge_val()
#define HUGE_VALL __builtin_huge_vall()
look at M_PI sitting there with 20 digits of commitment π that's main character energy fr fr. And the not-a-number / infinity squad β NAN, nanf, nan, nanl, INFINITY, HUGE_VALF, HUGE_VAL, HUGE_VALL β all mapped onto the compiler builtins, exactly as written above. Don't go editing those spellings, bestie, including the little '' in __builtin_nan(''). π
π¦ Functions π¦
and now the function declarations, in order, every single one, verbatim. f suffix = float, no suffix = double, l suffix = long double. The trio pattern repeats like a chorus and honestly? iconic. πΆ
float cosf (float x)
double cos (double x)
long double cosl (long double x)
float sinf (float x)
double sin (double x)
long double sinl (long double x)
float tanf (float x)
double tan (double x)
long double tanl (long double x)
static float fabsf (float __x)
static double fabs (double __x)
static long double fabsl (long double __x)
float fmodf (float x, float y)
double fmod (double x, double y)
long double fmodl (long double x, long double y)
float modff (float x, float *iptr)
double modf (double x, double *iptr)
long double modfl (long double x, long double *iptr)
float sqrtf (float x)
double sqrt (double x)
long double sqrtl (long double x)
float cbrtf (float x)
double cbrt (double x)
long double cbrtl (long double x)
float hypotf (float x, float y)
double hypot (double x, double y)
long double hypotl (long double x, long double y)
float floorf (float x)
double floor (double x)
long double floorl (long double x)
float ceilf (float x)
double ceil (double x)
long double ceill (long double x)
float frexpf (float x, int *pexp)
double frexp (double x, int *pexp)
long double frexpl (long double x, int *pexp)
float ldexpf (float x, int iexp)
double ldexp (double x, int iexp)
long double ldexpl (long double x, int iexp)
float expf (float x)
double exp (double x)
long double expl (long double x)
float coshf (float x)
double cosh (double x)
long double coshl (long double x)
float sinhf (float x)
double sinh (double x)
long double sinhl (long double x)
float tanhf (float x)
double tanh (double x)
long double tanhl (long double x)
float acosf (float x)
double acos (double x)
long double acosl (long double x)
float asinf (float x)
double asin (double x)
long double asinl (long double x)
float atanf (float x)
double atan (double x)
long double atanl (long double x)
float atan2f (float y, float x)
double atan2 (double y, double x)
long double atan2l (long double y, long double x)
float logf (float x)
double log (double x)
long double logl (long double x)
float log10f (float x)
double log10 (double x)
long double log10l (long double x)
float powf (float x, float y)
double pow (double x, double y)
long double powl (long double x, long double y)
int isnanf (float x)
int isnan (double x)
int isnanl (long double x)
int isinff (float x)
int isinf (double x)
int isinfl (long double x)
static int isfinitef (float __x)
static int isfinite (double __x)
static int isfinitel (long double __x)
static float copysignf (float __x, float __y)
static double copysign (double __x, double __y)
static long double copysignl (long double __x, long double __y)
int signbitf (float x)
int signbit (double x)
int signbitl (long double x)
float fdimf (float x, float y)
double fdim (double x, double y)
long double fdiml (long double x, long double y)
float fmaf (float x, float y, float z)
double fma (double x, double y, double z)
long double fmal (long double x, long double y, long double z)
float fmaxf (float x, float y)
double fmax (double x, double y)
long double fmaxl (long double x, long double y)
float fminf (float x, float y)
double fmin (double x, double y)
long double fminl (long double x, long double y)
float truncf (float x)
double trunc (double x)
long double truncl (long double x)
float roundf (float x)
double round (double x)
long double roundl (long double x)
long lroundf (float x)
long lround (double x)
long lroundl (long double x)
long lrintf (float x)
long lrint (double x)
long lrintl (long double x)
π¨ bestie heads up: some of these are declaredstaticβfabsf,fabs,fabsl,isfinitef,isfinite,isfinitel,copysignf,copysign,copysignl. And their params are named with the double-underscore form (__x,__y) instead of plainx/y. Copy it exactly as it appears up there, don't "tidy" it. π
Also peep the pointer args on modff, modf, modfl (float *iptr, double *iptr, long double *iptr) and the int *pexp on frexpf / frexp / frexpl. And fmaf / fma / fmal are the only ones rocking three params (x, y, z) β the three-argument girlies. π
And yes, lroundf / lround / lroundl and lrintf / lrint / lrintl return a plain long, not a float. Read the return types, bestie, they'll catch you slipping. π (roundf/round/roundl go back to the float/double/long double family.)
π« Non-Standard Math Functions π«
these ones are non-standard, so the page keeps them in their own little section. They're extra, they're not part of the standard set, and we're still listing them because every detail stays. periodt. β¨
float squaref (float x)
double square (double x)
long double squarel (long double x)
π Author π
- Generated automatically by Doxygen for AVR-LibC from the source code.
so no human author to thank here, it's a Doxygen robot that wrote this one and we respect its grind π«‘
okay that's genuinely the entire page bestie π no hidden sections, no secret SEE ALSO, no options list hiding at the bottom β macros, functions, non-standard extras, author, done. This whole thing is from AVR-LibC, Version 2.2.1 β go forth and compute, you absolute math baddie, mwah ππ β¨
π¦ where this page comes from
- ubuntu resolute: avr-libc 1:2.2.1-1build1 Β· BSD-3-Clause
- ubuntu stonking: avr-libc 1:2.2.1-1build1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms