std::abs(int), std::labs, std::llabs, std::imaxabs
来自cppreference.com
![]() |
该页由英文版wiki使用Google Translate机器翻译而来。
该翻译可能存在错误或用词不当。鼠标停留在文本上可以看到原版本。你可以帮助我们修正错误或改进翻译。参见说明请点击这里. |
在头文件 <cstdlib> 中定义
|
||
int abs( int n ); |
||
long abs( long n ); |
||
long long abs( long long n ); |
(C++11 起) | |
long labs( long n ); |
||
long long llabs( long long n ); |
(C++11 起) | |
在头文件 <cinttypes> 中定义
|
||
std::intmax_t abs( std::intmax_t n ); |
(C++11 起) | |
std::intmax_t imaxabs( std::intmax_t n ); |
(C++11 起) | |
计算一个整数的绝对值.
原文:
Computes the absolute value of an integer number.
[编辑] 参数
n | - | 整数值
|
[编辑] 返回值
的绝对值
n
(即|n|
)[编辑] 另请参阅
一个浮点值的绝对值(|x|) 原文: absolute value of a floating point value (|x|) (函数) | |
返回一个复数的幅度 原文: returns the magnitude of a complex number (函数模板) | |
std::absvalarray的每个元素的功能 原文: applies the function std::abs to each element of valarray (函数模板) |