Numerics - cppreference.com (original) (raw)
The C numerics library includes common mathematical functions and types, as well as support for random number generation.
Contents
- 1 Common mathematical functions
- 2 Floating-point environment
- 3 Pseudo-random number generation
- 4 Complex number arithmetic
- 5 Type-generic math
- 6 Bit manipulation (since C23)
- 7 Checked integer arithmetic (since C23)
- 8 See also
[edit] Common mathematical functions
The header <math.h> provides standard C library mathematical functions such as fabs, sqrt, and sin.
[edit] Floating-point environment
The header <fenv.h> defines flags and functions related to exceptional floating-point state, such as overflow and division by zero.
[edit] Pseudo-random number generation
The header <stdlib.h> also includes C-style random number generation via srand and rand.
[edit] Complex number arithmetic
The header <complex.h> provides types and functions to work with complex numbers.
[edit] Type-generic math
The header <tgmath.h> provides some macros for a function which names XXX:
real function:
float variant
XXXfdouble variant
XXXlong double variant
XXXlcomplex function:
float variant
cXXXfdouble variant
cXXXlong double variant
cXXXl
[edit] Bit manipulation (since C23)
The header <stdbit.h> provides macros and functions to work with the byte ordering and byte and bit representation of C objects.
[edit] Checked integer arithmetic (since C23)
Provides some type-generic macros for checked integer arithmetic: