What is the purpose of max_digits10 and how is it different from digits10?

To put it simple, digits10 is the number of decimal digits guaranteed to survive text → float → text round-trip. max_digits10 is the number of decimal digits needed to guarantee correct float → text → float round-trip. There will be exceptions to both but these values give the minimum guarantee. Read the original proposal on … Read more

Why is the maximum value of an unsigned n-bit integer 2ⁿ-1 and not 2ⁿ?

The -1 is because integers start at 0, but our counting starts at 1. So, 2^32-1 is the maximum value for a 32-bit unsigned integer (32 binary digits). 2^32 is the number of possible values. To simplify why, look at decimal. 10^2-1 is the maximum value of a 2-digit decimal number (99). Because our intuitive … Read more

maximum value of int

In C++: #include <limits> then use int imin = std::numeric_limits<int>::min(); // minimum value int imax = std::numeric_limits<int>::max(); std::numeric_limits is a template type which can be instantiated with other types: float fmin = std::numeric_limits<float>::min(); // minimum positive value float fmax = std::numeric_limits<float>::max(); In C: #include <limits.h> then use int imin = INT_MIN; // minimum value int … Read more