Fractions not working? 1/2 = 0.0?
807603Jan 15 2008 — edited Jan 16 2008I've been using Java for some time, and in all this time, I've never noticed this.
I have a program that needs to be able to see the value of a fraction.
Say I have something like 45/6, which equals 7.5 in the real world. However, in Java,it lists it as being 7.0. It does this with other fractions too, like 1/3=0.0, even when I'm putting it into a float or double.
Why is it doing this and how do I fix it?