I'm doing Math.pow(6.9, 3)
and getting 328.50900000000007
instead of 328.509
. How can I get just 328.509
?
I am referring specifically to JavaScript.
I'm doing Math.pow(6.9, 3)
and getting 328.50900000000007
instead of 328.509
. How can I get just 328.509
?
I am referring specifically to JavaScript.
Look here: Number.prototype.toFixed()
So you need to Math.pow(6.9, 3).toFixed(3)