Reputation: 4869
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.
Upvotes: 2
Views: 231
Reputation: 497
Try to use java.math.BigDecimal. The doc is right here: http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html
Upvotes: 0
Reputation: 4929
Try and use BigDecimal,
javadocs are here http://docs.oracle.com/javase/1.5.0/docs/api/java/math/BigDecimal.html
Upvotes: 3
Reputation: 284786
Try using double, which will give more precision. If that still isn't sufficient, you can use BigDecimal
.
Upvotes: 1