+ 1
long double and long long double
What is the difference between long double and long long double data type ? Both of them are 8 bytes and their capacitys are the same so why c++ has two different syntax?
1 Antwort
+ 2
long long double does not exist. It is undefined.
The double data type, has a size of 8 bytes, and a precision of 9. Thus, you can accurately store numbers only till the 9th decimal place after that, the number does not maintain precision. Thus, operating on such a number will result in precision loss.
The long double data type, is thus designed to maintain a greater precision, upto 15 digits. But the 16th digit will be vulnerable to precision loss.
We don't have any further extension for greater precision, but some external libraries exist having a precision upto 50, like thr GNU Multi-Precision Library or the Boost Multi-Precision Library.