+ 4
Difference between float and double..?
14 Answers
+ 10
A float is a 32 bit IEEE 754 floating point.
A double is a 64 bit IEEE 754 floating point.
so it is just a matter of precision because neither of the fraction portions .8 and .65 have a terminating binary representation, so there is some rounding error. the double has more precision so it has slightly less rounding error.
https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html
https://www.sololearn.com/discuss/95982/?ref=app
https://www.sololearn.com/discuss/736163/?ref=app
+ 6
@Jayshri I had deleted that message as soon as I typed realising that u said "ok" and not thank u.But due to some internet connection problem the message persisted there.Sorry for that :)
+ 5
you can store 2.4 in either of them ,It makes no difference except in terms of memory usage of double being greater than float
+ 4
@Jayshri
See, float can store upto 7 decimal digits while double upto 15.
There is no hard and fast rule to follow if u need to store 2.4 in either of them.But, it is better to store it in float just because it is saving memory for u.
and as in for java u say we don't use double, i don't agree with that since we CAN use it !
To be more clear u can ask the actual java challenge question
+ 2
what is double used for??
+ 1
if i have 2.4 value then it is store in which data type...
+ 1
u r r8 but agar 2.4 float mai store hora 1st preference kisko dena chahiye
+ 1
interview mai ques karte hai to us time bola jata hai ye data kaha store hoga tab ans float hota hai...but yaha java mai decimal point kam ho ya jyada hamesh float use kiya jata hai...mai challege ke time mai float pe tick kiya to muze wrong bata ya tabse confuse hu mai...i have completed my BCA so i am store this value in float if more than 2 decimal then store in double..datatype...yesi concept hamai bola gya hai...
+ 1
@infinity tqsm..
+ 1
is kk....đ
0
float is represented in 32 bits, with 1 sign bit, 8 bits of exponent, and 23 bits of the significand (or what follows from a scientific-notation number: 2.33728*1012; 33728 is the significand).
double is represented in 64 bits, with 1 sign bit, 11 bits of exponent, and 52 bits of significand.
0
when your program may use some value which is greater than the maximum range of float then it's Better to use double.
0
normaly we can say that double is use for storing the decimal no....in normal number we store in int ,long this type decimal number also store in float and double..float store for minimum decimal no..and double is also store decimal number but lagger number in decimal that number also store in double not in float according to os their storing capasity is different....