Im running in to this weird problem when I divide doubles in java.
System.out.println((0.39281 + 0.39281 + 0.39281)/ 3.0);
which gives me 0.39281000000000005
I was expecting obviously 0.39281 as the answer but in reality its giving me this trailing remainder too. I am just really confused as to why this is so because when i run System.out.println((0.39281 + 0.39281)/ 2.0), i get what i expected.
What would be a good work around for this, assuming i want to store accurate values, not necessarily printing them
Thanks guys