Numerical Data Types SummaryNumerical Data Types Summary

In the preceding chapters, we covered the numerical data types int, float, and double.
Additionally, we discussed type modifiers such as short, long, and unsigned.
By combining these types and modifiers, we can select the most appropriate data type for our specific task.

However, it's important to note that in C++, the unsigned and short type modifiers cannot be used with floating-point types such as float and double.

With that being said, here is a table containing all the types:

Data TypeSize (bytes)RangePrecision
short2-32,768 to 32,767
unsigned short20 to 65,535
int4-2,147,483,648 to 2,147,483,647
unsigned int40 to 4,294,967,295
long**8-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
unsigned long**80 to 18,446,744,073,709,551,615
float4±1.2e-38 to ±3.4e+387 digits
double8±2.2e-308 to ±1.8e+30815 digits
long double8 to 16*Huge*15-33 digits*

* means it depends on a system
** on Windows, long long instead of long

Everything was clear?

Section 1. Chapter 9