I am a bit confused about old/new so that's my question. What is the biggest numerical primitive datatype in the old and in the new C++ standard? (integer and floatingpoint)
regards & many thanks in advance
Oops
The long long data type is overkill for just about every application, but C will let you use it anyway. It's capable of storing at least −9,223,372,036,854,775,807 to 9,223,372,036,854,775,807. Alternatively, get even more overkill with unsigned long long , which will give you at least 0 to 18,446,744,073,709,551,615.
A short int can be any number in the range of 32,768 to 32,767. A regular int, or just int, has a much larger range of 2,147,483,648 to 2,147,483,647. A long int, referred to as long or double, has a range of 9,223,372,036,854,775,808 to 9,223,372,036,854,775,807.
A primitive type is a data type where the values that it can represent have a very simple nature (a number, a character or a truth-value); the primitive types are the most basic building blocks for any programming language and are the base for more complex data types.
In the 1998 standard, long int
and unsigned long int
are the types that are at least as big as any of the standard's other integral types (§3.9.1/2-3). (They may or may not be "the biggest" types. It's possible for long int
to be the same size as int
, for instance. For that matter, char
could be the same size, too.) The floating-point long double
provides at least as much precision as the other two floating-point types (§3.9.1/8).
In the draft standard for C++0x (n3092), the types are long long int
and unsigned long long int
(§3.9.1/2-3). The most precise floating-point type remains long double
(§3.9.1/8).
Implementations may provide bigger types beyond what the standard calls for. Check the documentation for details on that.
Have a look at
C and C++ Data Types
Data Type Ranges
Variables. Data Types. section Fundamental data types
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With