I had a problem similar to this not long ago and I had to implement my numbers with the BigDecimal class... Basically it was a thing calculating money and it would give out very weird values when...