Namespaces
Variants
Views
Actions

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

From cppreference.com
< cpp‎ | numeric‎ | math
Revision as of 15:42, 1 July 2013 by P12bot (Talk | contribs)

 
 
 
Common mathematical functions
Functions
Basic operations
abs(int)labsllabsimaxabs
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Exponential functions
(C++11)
(C++11)
(C++11)
(C++11)
Power functions
(C++11)
(C++11)
Trigonometric and hyperbolic functions
(C++11)
(C++11)
(C++11)
Error and gamma functions
(C++11)
(C++11)
(C++11)
(C++11)
Nearest integer floating point operations
(C++11)(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Floating point manipulation functions
(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)
(C++11)
Classification/Comparison
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Macro constants
(C++11)(C++11)(C++11)(C++11)(C++11)
 
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>
(since C++11)
(since C++11)

Computes the absolute value of an integer number.

Parameters

n - integer value

Return value

the absolute value of n (i.e. |n|)

See also

absolute value of a floating point value (|x|)
(function) [edit]
returns the magnitude of a complex number
(function template) [edit]
applies the function std::abs to each element of valarray
(function template) [edit]