javascript - Incorrect results in calculations with decimal values with four digits after dot -


this question has answer here:

i have javascript function returns result of multiplications using decimal values (four digits after dot).

but, in conditions, result mess this:

3.9050 * 9 = 35.144999999999996. 

what should normalize results?

use .tofixed(numberofdecsyouwant)

var num = 3.9050 * 9;  console.log(num);  //35.144999999999996  console.log(num.tofixed(4))  //35.1450


Comments

Popular posts from this blog

Receive udp packets in android gstreamer -

php - Extract Text from HTTP referer -

matplotlib - PYTHON: Annotate boxes disapear dependant on range -