|
| 1 | +# Std C99 |
| 2 | + |
| 3 | +## `<math.h>` |
| 4 | + |
| 5 | +## Classification |
| 6 | + |
| 7 | +```c |
| 8 | +// 7.12.2 The FP_CONTRACT pragma |
| 9 | +#pragma STDC FP_CONTRACT on-off-switch |
| 10 | + |
| 11 | +// 7.12.3 Classification macros |
| 12 | +int fpclassify(real-floating x); |
| 13 | + |
| 14 | +int isfinite(real-floating x); |
| 15 | +int isinf(real-floating x); |
| 16 | +int isnan(real-floating x); |
| 17 | +int isnormal(real-floating x); |
| 18 | + |
| 19 | +int signbit(real-floating x); |
| 20 | +``` |
| 21 | +
|
| 22 | +## Trigonometric |
| 23 | +
|
| 24 | +```c |
| 25 | +// 7.12.4 Trigonometric functions |
| 26 | +double acos(double x); |
| 27 | +float acosf(float x); |
| 28 | +long double acosl(long double x); |
| 29 | +double asin(double x); |
| 30 | +float asinf(float x); |
| 31 | +long double asinl(long double x); |
| 32 | +double atan(double x); |
| 33 | +float atanf(float x); |
| 34 | +long double atanl(long double x); |
| 35 | +
|
| 36 | +double atan2(double y, double x); |
| 37 | +float atan2f(float y, float x); |
| 38 | +long double atan2l(long double y, long double x); |
| 39 | +
|
| 40 | +double cos(double x); |
| 41 | +float cosf(float x); |
| 42 | +long double cosl(long double x); |
| 43 | +double sin(double x); |
| 44 | +float sinf(float x); |
| 45 | +long double sinl(long double x); |
| 46 | +double tan(double x); |
| 47 | +float tanf(float x); |
| 48 | +long double tanl(long double x); |
| 49 | +``` |
| 50 | + |
| 51 | +## Hyperbolic |
| 52 | + |
| 53 | +```c |
| 54 | +// 7.12.5 Hyperbolic functions |
| 55 | +double acosh(double x); |
| 56 | +float acoshf(float x); |
| 57 | +long double acoshl(long double x); |
| 58 | +double asinh(double x); |
| 59 | +float asinhf(float x); |
| 60 | +long double asinhl(long double x); |
| 61 | +double atanh(double x); |
| 62 | +float atanhf(float x); |
| 63 | +long double atanhl(long double x); |
| 64 | + |
| 65 | +double cosh(double x); |
| 66 | +float coshf(float x); |
| 67 | +long double coshl(long double x); |
| 68 | +double sinh(double x); |
| 69 | +float sinhf(float x); |
| 70 | +long double sinhl(long double x); |
| 71 | +double tanh(double x); |
| 72 | +float tanhf(float x); |
| 73 | +long double tanhl(long double x); |
| 74 | +``` |
| 75 | +
|
| 76 | +## Exponential and logarithmic |
| 77 | +
|
| 78 | +```c |
| 79 | +// 7.12.6 Exponential and logarithmic functions |
| 80 | +double exp(double x); |
| 81 | +float expf(float x); |
| 82 | +long double expl(long double x); |
| 83 | +
|
| 84 | +double exp2(double x); |
| 85 | +float exp2f(float x); |
| 86 | +long double exp2l(long double x); |
| 87 | +
|
| 88 | +double expm1(double x); |
| 89 | +float expm1f(float x); |
| 90 | +long double expm1l(long double x); |
| 91 | +
|
| 92 | +double frexp(double value, int *exp); |
| 93 | +float frexpf(float value, int *exp); |
| 94 | +long double frexpl(long double value, int *exp); |
| 95 | +
|
| 96 | +int ilogb(double x); |
| 97 | +int ilogbf(float x); |
| 98 | +int ilogbl(long double x); |
| 99 | +double ldexp(double x, int exp); |
| 100 | +float ldexpf(float x, int exp); |
| 101 | +long double ldexpl(long double x, int exp); |
| 102 | +
|
| 103 | +double log(double x); |
| 104 | +float logf(float x); |
| 105 | +long double logl(long double x); |
| 106 | +
|
| 107 | +double log10(double x); |
| 108 | +float log10f(float x); |
| 109 | +long double log10l(long double x); |
| 110 | +
|
| 111 | +double log1p(double x); |
| 112 | +float log1pf(float x); |
| 113 | +long double log1pl(long double x); |
| 114 | +
|
| 115 | +double log2(double x); |
| 116 | +float log2f(float x); |
| 117 | +long double log2l(long double x); |
| 118 | +
|
| 119 | +double logb(double x); |
| 120 | +float logbf(float x); |
| 121 | +long double logbl(long double x); |
| 122 | +
|
| 123 | +double modf(double value, double *iptr); |
| 124 | +float modff(float value, float *iptr); |
| 125 | +long double modfl(long double value, long double *iptr); |
| 126 | +
|
| 127 | +double scalbn(double x, int n); |
| 128 | +float scalbnf(float x, int n); |
| 129 | +long double scalbnl(long double x, int n); |
| 130 | +double scalbln(double x, long int n); |
| 131 | +float scalblnf(float x, long int n); |
| 132 | +long double scalblnl(long double x, long int n); |
| 133 | +``` |
| 134 | + |
| 135 | +## Power and Absolute-value |
| 136 | + |
| 137 | +```c |
| 138 | +// 7.12.7 Power and absolute-value functions |
| 139 | +double cbrt(double x); |
| 140 | +float cbrtf(float x); |
| 141 | +long double cbrtl(long double x); |
| 142 | + |
| 143 | +double fabs(double x); |
| 144 | +float fabsf(float x); |
| 145 | +long double fabsl(long double x); |
| 146 | + |
| 147 | +double hypot(double x, double y); |
| 148 | +float hypotf(float x, float y); |
| 149 | +long double hypotl(long double x, long double y); |
| 150 | + |
| 151 | +double pow(double x, double y); |
| 152 | +float powf(float x, float y); |
| 153 | +long double powl(long double x, long double y); |
| 154 | + |
| 155 | +double sqrt(double x); |
| 156 | +float sqrtf(float x); |
| 157 | +long double sqrtl(long double x); |
| 158 | +``` |
| 159 | +
|
| 160 | +## Error and gamma |
| 161 | +
|
| 162 | +```c |
| 163 | +// 7.12.8 Error and gamma functions |
| 164 | +double erf(double x); |
| 165 | +float erff(float x); |
| 166 | +long double erfl(long double x); |
| 167 | +double erfc(double x); |
| 168 | +float erfcf(float x); |
| 169 | +long double erfcl(long double x); |
| 170 | +
|
| 171 | +double lgamma(double x); |
| 172 | +float lgammaf(float x); |
| 173 | +long double lgammal(long double x); |
| 174 | +double tgamma(double x); |
| 175 | +float tgammaf(float x); |
| 176 | +long double tgammal(long double x); |
| 177 | +``` |
| 178 | + |
| 179 | +## Nearest integer |
| 180 | + |
| 181 | +```c |
| 182 | +// 7.12.9 Nearest integer functions |
| 183 | +double ceil(double x); |
| 184 | +float ceilf(float x); |
| 185 | +long double ceill(long double x); |
| 186 | + |
| 187 | +double floor(double x); |
| 188 | +float floorf(float x); |
| 189 | +long double floorl(long double x); |
| 190 | + |
| 191 | +double nearbyint(double x); |
| 192 | +float nearbyintf(float x); |
| 193 | +long double nearbyintl(long double x); |
| 194 | +double rint(double x); |
| 195 | +float rintf(float x); |
| 196 | +long double rintl(long double x); |
| 197 | +long int lrint(double x); |
| 198 | +long int lrintf(float x); |
| 199 | +long int lrintl(long double x); |
| 200 | +long long int llrint(double x); |
| 201 | +long long int llrintf(float x); |
| 202 | +long long int llrintl(long double x); |
| 203 | + |
| 204 | +double round(double x); |
| 205 | +float roundf(float x); |
| 206 | +long double roundl(long double x); |
| 207 | +long int lround(double x); |
| 208 | +long int lroundf(float x); |
| 209 | +long int lroundl(long double x); |
| 210 | +long long int llround(double x); |
| 211 | +long long int llroundf(float x); |
| 212 | +long long int llroundl(long double x); |
| 213 | + |
| 214 | +double trunc(double x); |
| 215 | +float truncf(float x); |
| 216 | +long double truncl(long double x); |
| 217 | +``` |
| 218 | +
|
| 219 | +## Remainder |
| 220 | +
|
| 221 | +```c |
| 222 | +// 7.12.10 Remainder functions |
| 223 | +double fmod(double x, double y); |
| 224 | +float fmodf(float x, float y); |
| 225 | +long double fmodl(long double x, long double y); |
| 226 | +
|
| 227 | +double remainder(double x, double y); |
| 228 | +float remainderf(float x, float y); |
| 229 | +long double remainderl(long double x, long double y); |
| 230 | +
|
| 231 | +double remquo(double x, double y, int *quo); |
| 232 | +float remquof(float x, float y, int *quo); |
| 233 | +long double remquol(long double x, long double y, int *quo); |
| 234 | +``` |
| 235 | + |
| 236 | +## Manipulation |
| 237 | + |
| 238 | +```c |
| 239 | +// 7.12.11 Manipulation functions |
| 240 | +double copysign(double x, double y); |
| 241 | +float copysignf(float x, float y); |
| 242 | +long double copysignl(long double x, long double y); |
| 243 | + |
| 244 | +double nan(const char *tagp); |
| 245 | +float nanf(const char *tagp); |
| 246 | +long double nanl(const char *tagp); |
| 247 | + |
| 248 | +double nextafter(double x, double y); |
| 249 | +float nextafterf(float x, float y); |
| 250 | +long double nextafterl(long double x, long double y); |
| 251 | + |
| 252 | +double nexttoward(double x, long double y); |
| 253 | +float nexttowardf(float x, long double y); |
| 254 | +long double nexttowardl(long double x, long double y); |
| 255 | +``` |
| 256 | +
|
| 257 | +## Maximum, minimum |
| 258 | +
|
| 259 | +```c |
| 260 | +// 7.12.12 Maximum, minimum, and positive difference functions |
| 261 | +double fdim(double x, double y); |
| 262 | +float fdimf(float x, float y); |
| 263 | +long double fdiml(long double x, long double y); |
| 264 | +
|
| 265 | +double fmax(double x, double y); |
| 266 | +float fmaxf(float x, float y); |
| 267 | +long double fmaxl(long double x, long double y); |
| 268 | +
|
| 269 | +double fmin(double x, double y); |
| 270 | +float fminf(float x, float y); |
| 271 | +long double fminl(long double x, long double y); |
| 272 | +``` |
| 273 | + |
| 274 | +## Floating multiply-add |
| 275 | + |
| 276 | +```c |
| 277 | +// 7.12.13 Floating multiply-add |
| 278 | +double fma(double x, double y, double z); |
| 279 | +float fmaf(float x, float y, float z); |
| 280 | +long double fmal(long double x, long double y, long double z); |
| 281 | +``` |
| 282 | +
|
| 283 | +## Comparison |
| 284 | +
|
| 285 | +```c |
| 286 | +// 7.12.14 Comparison macros |
| 287 | +int isgreater(real-floating x, real-floating y); |
| 288 | +int isgreaterequal(real-floating x, real-floating y); |
| 289 | +
|
| 290 | +int isless(real-floating x, real-floating y); |
| 291 | +int islessequal(real-floating x, real-floating y); |
| 292 | +int islessgreater(real-floating x, real-floating y); |
| 293 | +
|
| 294 | +int isunordered(real-floating x, real-floating y); |
| 295 | +``` |
0 commit comments