High-precision floating point numbers? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

High-precision floating point numbers?

I read that variables of the datatype float or double have a true precision of only a few digits. What can I do if I need variables with a higher precision?

4th Jul 2016, 10:45 PM
MaxCode
2 Answers
+ 3
try long double instead of double for a better precision. beware that the printed-at-screen precision is less that the real one. Depend on what function you use to prinr your number at screen you can configure the number of decimals to display.
5th Jul 2016, 6:53 AM
Dorian
+ 2
unsigned long double or an array that stores the zecimals.
5th Jul 2016, 8:07 PM
Mihai Dancaescu
Mihai Dancaescu - avatar