What is the largest numerical primitive data type in C ++ (old / new standard)

I'm a little confused by the old / new, so my question is. What is the largest numerical primitive data type in the old and new C ++ standard? (integer and floating point)

hello and thank you very much in advance
Unfortunately,

+6
c ++
source share
3 answers

In the 1998 standard, long int and unsigned long int are types that are no less large than any of the standard other integral types (§3.9.1 / 2-3). (They may or may not be the “largest” types. For example, for long int can be the same size as int . In this case, char can be the same size.) Floating -point long double provides at least this Same precision as the other two types of floating point (§3.9.1 / 8).

In the draft standard for C ++ 0x ( n3092 ), the types long long int and unsigned long long int (§3.9 0,1 / 2-3). The most accurate floating point type remains long double (§3.9.1 / 8).

Implementations can provide larger types, in addition to what the standard requires. See the documentation for more details.

+6
source share
+2
source share

In C ++ 03, long [int] and unsigned long [int] have the largest integral range, and long double has the greatest accuracy and FP range.

In C ++ 0x, intmax_t and uintmax_t have the largest integral range and may even be greater than long long . For example, it would be reasonable if the implementation made both long and long long 64-bit and made intmax_t 128-bit.

intmax_t just used with C99, so if your implementation supports C99, you do not need to require C ++ 0x. Just include stdint.h instead of cstdint . Using "C-style" headers is absolutely safe, although I'm not sure if there is a good way to test CUP typedefs in C ++.

The exact or conveniently named floating point types were not introduced with C99 or C ++ 0x, so avoid anything like float64_t or floatmax_t if you want to carry floatmax_t .

+1
source share

All Articles