复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16#include <iostream> #include <limits> int main() { double inf = std::numeric_limits<double>::infinity(); double max = std::numeric_limits<double>::max(); double min = std::numeric_limits<double>::min(); std::cout << "double inf :" << inf << std::endl; std::cout << "double max :" << max << std::endl; std::cout << "double min :" << min << std::endl; std::cout << "double -inf :" << -inf << std::endl; std::cout << "double -max :" << -max << std::endl; std::cout << "double -min :" << -min << std::endl; return 0;
程序输出:
复制代码
1
2
3
4
5
6
7double inf :inf double max :1.79769e+308 double min :2.22507e-308 double -inf :-inf double -max :-1.79769e+308 double -min :-2.22507e-308
最后
以上就是高大蓝天最近收集整理的关于[cpp]double最大值、最小值及正无穷的全部内容,更多相关[cpp]double最大值、最小值及正无穷内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复