35.87 * 100 = 3586.9999999999995 not 3587. 1. Why is this? 2. Most other decimal numbers work fine when I use this logic to get the same number as the original number without decimals (after I have removed the part after the decimal point)
If you need to write software that deals with for example financial data (money), you shouldn't use float or double. You should use class BigDecimal, which can store an arbitrary number of decimal digits.