Is there any way to calculate numbers beyond the 32bit integer limit in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Is there any way to calculate numbers beyond the 32bit integer limit in C++?

Can we calculate/display numbers numbers which are the beyond the 32bit integer limit (2,147,483,647) ? Is there any code to do so? If our computers are 64bit, then why can't a variable store upto 64bit value?

30th Jul 2023, 9:51 AM
Tanvesh Kaviskar
Tanvesh Kaviskar - avatar
3 Answers
30th Jul 2023, 12:58 PM
JaScript
JaScript - avatar
+ 3
Sanvi Kaviskar in the compiler used by Sololearn you can get 64 bits of integer precision by using intrinsic datatypes. On other architectures and compilers the sizes may be different. Here I have listed the available bits by type: # Bits of Precision: 8 (char) 8 (unsigned char) 15 (short int) 16 (unsigned short int) 31 (int) 32 (unsigned int) 63 (long int) 63 (long long int) 64 (unsigned long int) 64 (unsigned long long int) Beyond that, go with BigInt as suggested by JaScript.
30th Jul 2023, 5:14 PM
Brian
Brian - avatar
0
you can also create a data type for large numbers
25th Aug 2023, 5:55 PM
Bebida Roja
Bebida Roja - avatar