Loss of precision - int -> float or double
Posted
by stan
on Stack Overflow
See other posts from Stack Overflow
or by stan
Published on 2010-05-06T12:35:00Z
Indexed on
2010/05/06
12:38 UTC
Read the original article
Hit count: 245
I have an exam question i am revising for and the question is for 4 marks
"In java we can assign a int to a double or a float". Will this ever loose infromation and why?
I have put that because ints are normally of fixed length or size - the precision for sotring data is finite, where storing information in floating point can be infinite, essentially we loose infromation because of this
Now i am a little sketchy as to whetehr or not i am hitting the right areas here. I very sure it will loose precision but i cant exactly put my finger on why. Can i getsome help please
Thanks
© Stack Overflow or respective owner