Precision error adding doubles

Posted by wrongusername on Stack Overflow See other posts from Stack Overflow or by wrongusername
Published on 2010-03-17T23:09:50Z Indexed on 2010/03/17 23:11 UTC
Read the original article Hit count: 375

Filed under:
|
|
|

When I try to do

term[number].coefficient += co;

with both term[number].coefficient and co doubles, adding -8.2 to +1 gives me -7.300000000000001. How can I make it equal to 7.3?

© Stack Overflow or respective owner

Related posts about precision

Related posts about java