I have some float values in which i do some multiplication
However, the result is a -0, which I found out that the value is too small, hence converted to this answer.
I need to compare the different results which are of float, hence if its -0, I cannot do comparsion.
How can I resolve this? Many thanks in advance.
-
Read this link on the same topic stackoverflow.com/questions/10386596/…SKC– SKC2012年10月15日 05:39:29 +00:00Commented Oct 15, 2012 at 5:39
3 Answers 3
Try and use BigDecimal,
javadocs are here http://docs.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html
Comments
Try using double, which will give more precision. If that still isn't sufficient, you can use BigDecimal.
Comments
Try to use java.math.BigDecimal. The doc is right here: http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html