Decimal problem in Java
- by Jerome
I am experimenting with writing a java class for financial engineering (hobby of mine). The algorithm that I desire to implement is:
100 / 0.05 = 2000
Instead I get:
100 / 0.05 = 2000.9999999999998
I understand the problem to be one with converting from binary numbers to decimals (float -- int). I have looked at the BigDecimal class on the…