C++中数值极限的表示

关于C++中的数值极限的表示

Class numeric_limits<>

C++中的数值极限可以利用 class numeric_limits<>表示,常用方法如下:

#include 
#include 
#include 

using namespace std;

int main(){
	
	cout << numeric_limits::max()<::max()<::max()<::min()<::max()<

除了max()和min()方法之外,该类该可以提供其他的一些成员函数:
 

成员 意义
is_signed 型别带有正负号
round_style 四舍五入的风格

is_specialized

型别是否有极值
。。。 。。。。

参考书籍:

《C++标准程序库》

你可能感兴趣的:(C++)