#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;
程序輸出:
double 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