Floating point numbers in C | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Floating point numbers in C

In C programming, float takes up 32 bits(4bytes) and it should store a number as : 1 bit for sign, 8 bit for exponent and 23/24 bit for mantissa but when i try to store value of pie to 20 decimal places it starts to loose its precision after only 6 decimal places. Why is that?

13th Apr 2020, 10:26 AM
Ashutosh B. Rajan
Ashutosh B. Rajan - avatar
1 Answer
0
Thanks! got it. Then is there any way to store highly precise(10^-35) value in C ? Even double can store up to 15 digits only 🤔.
13th Apr 2020, 10:37 AM
Ashutosh B. Rajan
Ashutosh B. Rajan - avatar