+ 12

So what is the difference between a float, double, and long double?

Aren't they all the same function with more size. When would I use a double over a float? Or a float over a long double?

6th May 2016, 7:24 PM
SJKakjASKAL
12 ответов
+ 15
They represent same kind of data type but with different sizes and precision.. if you don't require your decimal number to be very precise, then it's better to use float.. this helps in using ur system memory efficiently..
11th Jun 2016, 1:03 AM
shilpa7420
shilpa7420 - avatar
+ 8
first of all they are not functions, but are data types. They have different sizes and precision.
16th Oct 2016, 7:53 AM
Nelli
Nelli - avatar
+ 1
Basically all of them represent the decimal values such as 3.14 The main difference between them is that in float we can store values upto 4 bytes (6 places after decimal point) Double upto 8 bytes And long double even more than float and double.
2nd Jan 2017, 12:48 PM
ash
ash - avatar
0
i think its a matter of size and precision and accuracy. for more precise calxulations, you would use double etc.
8th May 2016, 2:39 PM
Taqi Mushaidi
Taqi Mushaidi - avatar
0
each of them has its own range ,thus its size changes
11th Jun 2016, 10:43 PM
ahmed osama
ahmed osama - avatar
0
they all are numbers which include decimal point in it.. they differ just in range n size i-e how many digits after the decimal point..
15th Jun 2016, 1:47 AM
Mahrukh Ahmed
Mahrukh Ahmed - avatar
0
size of the decimal points i think
2nd Jan 2017, 5:09 AM
Lady Dennibeth O. Dimag
Lady Dennibeth O. Dimag - avatar
0
hello buddy , they all are deta type . float, double and long double are different becouse of memory space .
2nd Jan 2017, 5:44 AM
Amit kumar
Amit kumar - avatar
0
well float is of 4 bytes and double n long are of 8bytes. You need long if the no. you need to save is in 2^32 and if it's more than that you can go with double.
2nd Jan 2017, 5:58 AM
Ashwinikumar Chaubey
Ashwinikumar Chaubey - avatar
0
both are a data type.they use for select the memory size for store a variable.
2nd Jan 2017, 4:41 PM
Muhammad Adeel
Muhammad Adeel - avatar
0
مرحبا
2nd Jan 2017, 7:52 PM
عاشقه الزهراء
عاشقه الزهراء - avatar
- 2
Difference is just about the Range, Otherwise no difference at all. You Store whatever value you want, php will automatically save it accordingly.
2nd Jan 2017, 7:23 AM
Anshul Shivhare
Anshul Shivhare - avatar