Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/numeric/math/abs"

From cppreference.com
< cpp‎ | numeric‎ | math
m (Use since= and until= params of {{dcl}} template.)
(+see c)
Line 35: Line 35:
  
 
===Return value===
 
===Return value===
 
+
The absolute value of {{tt|n}} (i.e. {{tt|{{!}}n{{!}}}}).
the absolute value of {{tt|n}} (i.e. {{tt|{{!}}n{{!}}}})
+
  
 
===See also===
 
===See also===
 
 
{{dsc begin}}
 
{{dsc begin}}
 
{{dsc inc | cpp/numeric/math/dsc fabs}}
 
{{dsc inc | cpp/numeric/math/dsc fabs}}
 
{{dsc inc | cpp/numeric/complex/dsc abs}}
 
{{dsc inc | cpp/numeric/complex/dsc abs}}
 
{{dsc inc | cpp/numeric/valarray/dsc abs}}
 
{{dsc inc | cpp/numeric/valarray/dsc abs}}
 +
{{dsc see c | c/numeric/math/abs | abs | labs | llabs}}
 
{{dsc end}}
 
{{dsc end}}
  

Revision as of 05:39, 28 August 2013

 
 
 
 
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 abs to each element of valarray
(function template) [edit]
C documentation for abs, labs, llabs