Double operation problem Java

Posted by Daniel G. R. on Stack Overflow See other posts from Stack Overflow or by Daniel G. R.
Published on 2010-05-21T02:59:39Z Indexed on 2010/05/21 3:10 UTC
Read the original article Hit count: 215

Filed under:
|
|

When I do the following in Java:

System.out.println(2.2-2.0);

It unexpectedly prints the following:

0.20000000000000018

What is this and how can I avoid this?

© Stack Overflow or respective owner

Related posts about java

Related posts about double