Skip to the content of the web site.

The numeric library scalar functions

These functions are found in the #include <numeric> library. In this document, let T represent any type name.

T std::gcd( T m, T n )
T std::lcm( T m, T n )

These calculate the greatest common divisor and the least common multiple of the arguments, respectively.

T std::midpoint( T m, T n )

These calculate the midpoint between the two arguments without causing an overflow or underflow.

T *std::midpoint( T *m, T *n )

These calculate the midpoint between the two addresses without causing an overflow or underflow.