##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::abs(int), std::labs, std::llabs, std::imaxabs

From cppreference.com
< cpp‎ | numeric‎ | math

Defined in header `<cstdlib>` |  |
int abs( int n ); |  |
long abs( long n ); |  |
long long abs( long long n ); |  | (since C++11)
long labs( long n ); |  |
long long llabs( long long n ); |  | (since C++11)
Defined in header `<cinttypes>` |  |
std::intmax_t abs( std::intmax_t n ); |  | (since C++11)
std::intmax_t imaxabs( std::intmax_t n ); |  | (since C++11)

Computes the absolute value of an integer number.

### [edit] Parameters

n | - | integer value

### [edit] Return value

The absolute value of `n` (i.e. `|n|`).

### [edit] See also

abs(float) fabs | absolute value of a floating point value (|x|) (function) [edit]
abs(std::complex) | returns the magnitude of a complex number (function template) [edit]
abs(std::valarray) | applies the function std::abs to each element of valarray (function template) [edit]
C documentation for abs, labs, llabs

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/numeric/math/abs&oldid=64931"