Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the biggest numerical primitive datatype in C++ (old/new standard)

Tags:

c++

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

like image 597
OlimilOops Avatar asked Apr 17 '10 07:04

OlimilOops


People also ask

What is the biggest data type in C?

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.

Which numeric data type has the largest range C++?

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.

What is primitive data type in C?

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.


2 Answers

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.

like image 103
Rob Kennedy Avatar answered Sep 19 '22 13:09

Rob Kennedy


Have a look at

C and C++ Data Types

Data Type Ranges

Variables. Data Types. section Fundamental data types

like image 26
Adriaan Stander Avatar answered Sep 20 '22 13:09

Adriaan Stander