I was trying to obtain a random number rounded off to its first decimal place. I got what I wanted with the following code,
(Math.floor(Math.random() * 100) / 10)
But when trying to deduct a value from the output, I had unexpected decimals showing up for some numbers.
(Math.floor(Math.random() * 100) / 10) - 1 //When deducting the problem occurs.
Any clues as to why this is happening?