std::numeric_limits<T>::max(),min()及lowest()
根據std::numeric_limits,如果T屬於浮點數,則:
std::numeric_limits<T>::max()回傳該型別的最大值
std::numeric_limits<T>::min()回傳該型別的"最小正數"
std::numeric_limits<T>::lowest()回傳該型別的最小值(為負數或0)。
max, min, lowest for 5 different data types:
int:
2147483647
-2147483648
-2147483648
unsigned int:
4294967295
0
0
float:
3.40282e+38
1.17549e-38
-3.40282e+38
double:
1.79769e+308
2.22507e-308
-1.79769e+308
long double:
1.18973e+4932
3.3621e-4932
-1.18973e+4932
原文链接:https://blog.csdn.net/keineahnung2345/article/details/104181062