What is the difference between type double and long double? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the difference between type double and long double?

Floating type numbers

17th Jan 2019, 7:12 PM
noaavra
7 Answers
+ 3
Per the C++ standard, there might not be any difference. However, if there is, the long double will be bigger. Float, double, and long double can all be the same. The only guarentee is float <= double <= long double in storage size. Usually, the compiler will provide three different sizes because the hardware supports them. If it only has two, float will be the smaller one and the doubles the bigger. If it has one, they are all the same.
18th Jan 2019, 12:21 AM
John Wells
John Wells - avatar
+ 4
The term 'word' as applied in computing is composed of two bytes usually used to store integers. floating point types are usually store in double word or in four bytes. long double is eight bytes to store larger flooating point values. it is an issue of precision.
18th Jan 2019, 12:27 AM
Da2
Da2 - avatar
+ 4
Read on pointers as well. It can help you understand the importance of these data types
18th Jan 2019, 8:33 AM
Da2
Da2 - avatar
+ 3
Thank you :)
18th Jan 2019, 8:30 AM
noaavra
+ 2
It's my next lesson...
18th Jan 2019, 8:40 AM
noaavra
+ 2
Pointers are very important. Understanding it will also help you deal with parameter passing with functions
18th Jan 2019, 8:56 AM
Da2
Da2 - avatar
0
Double takes 8 and long double more than 8 i think
17th Feb 2019, 8:36 AM
Ibrahimu Saidi🇹🇿
Ibrahimu Saidi🇹🇿 - avatar