2

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.

asked Oct 15, 2012 at 5:29
1

3 Answers 3

3
answered Oct 15, 2012 at 5:31
Sign up to request clarification or add additional context in comments.

Comments

1

Try using double, which will give more precision. If that still isn't sufficient, you can use BigDecimal.

answered Oct 15, 2012 at 5:31

Comments

0

Try to use java.math.BigDecimal. The doc is right here: http://docs.oracle.com/javase/7/docs/api/java/math/BigDecimal.html

answered Oct 15, 2012 at 5:36

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.