+ 1
Can anyone please understand me whats the difference between float double and long double?
Specially by examples!
2 ответов
+ 2
The size and precision. The types store larger numbers with a better precision in the increasing order of float < double < long double.
Usually, all you need is size, but precision matter when you perform a large number of operations on your number. Then, float will no longer maintain a precise result to the required precision. You can still get a better precision in such cases, only if you use long double. But for small numbers, float is enough.
Float, is stored in 4 bytes, and has a precision of 4-6 digits. Double, is stored in 8 bytes, and has a precision of 9-10 digits. Long Double is stored in 15 bytes, and has a precision of 15-19 digits.