floating point – What is DBL_MAX in C++?

floating point – What is DBL_MAX in C++?

As it was said by others DBL_MAX defined in header <cfloat> in C++ or <float.h> in C is the value of maximum representable finite floating-point (double) number

In C++ you can get the same value using class std::numeric_limits defined in header <limits>

std::numeric_limits<double>::max()

Here is an example of using the both approaches

#include <iostream>
#include <cfloat>
#include <limits>

int main() 
{
    std::cout << DBL_MAX << std::endl;
    std::cout << std::numeric_limits<double>::max() << std::endl;


    return 0;
}

At www.ideone.com (on-line C++ compiler) the output is

1.79769e+308
1.79769e+308

It is a constant defined in float.h or <cfloat>. This header describes the characteristics of floating types for the specific system and compiler implemetation used.

DBL_MAX is maximum finite representable floating-point number.

http://en.cppreference.com/w/cpp/types/climits

floating point – What is DBL_MAX in C++?

The maximum finite representable floating-point number.

Take a look here if you find anything similar.


Leave a Reply

Your email address will not be published.