Here\'s the scenario: I\'m getting .9999999999999999 when I should be getting 1.0. I can afford to lose a decimal place of precision, so I\'m u
.9999999999999999
1.0
As I understand, you want to remove the trailing zeros in the string that you obtained via toFixed(). This is a pure string operation:
toFixed()
var x = 1.1230000; var y = x.toFixed(15).replace(/0+$/, ""); // ==> 1.123