Android Question Math accuracy problems

JLS

Member
Licensed User
Longtime User
Hi everybody:

As my very first Project, I'm creating a calculator.

I have found for example:

0.3 * 3 = 0.89999999999999

Why is this happening? How can it be fixed?

Thanks in advance
 

sorex

Expert
Licensed User
Longtime User
it's because the way how computers work with floating numbers.

you'll have to apply some rounding.
 
Upvote 0
Top