Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Numerical Data Types Summary | Numerical Data Types
course content

Contenido del Curso

C++ Data Types

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. By combining these types and modifiers, we can select the most appropriate data type for our specific task.

Note

The short type modifier cannot be used with floating-point types such as float and double.

Data Type Size (bytes) Range Precision
short 2 -32,768 to 32,767
int 4 -2,147,483,648 to 2,147,483,647
long 8 -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float 4 ±1.2e-38 to ±3.4e+38 7 digits
double 8 ±2.2e-308 to ±1.8e+308 15 digits
long double 8 to 16* Huge* 15-33 digits*

* means it depends on a system

** on Windows, long long instead of long

¿Todo estuvo claro?

Sección 2. Capítulo 6
course content

Contenido del Curso

C++ Data Types

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. By combining these types and modifiers, we can select the most appropriate data type for our specific task.

Note

The short type modifier cannot be used with floating-point types such as float and double.

Data Type Size (bytes) Range Precision
short 2 -32,768 to 32,767
int 4 -2,147,483,648 to 2,147,483,647
long 8 -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
float 4 ±1.2e-38 to ±3.4e+38 7 digits
double 8 ±2.2e-308 to ±1.8e+308 15 digits
long double 8 to 16* Huge* 15-33 digits*

* means it depends on a system

** on Windows, long long instead of long

¿Todo estuvo claro?

Sección 2. Capítulo 6
some-alt