for eg: 38.23 * 100 returns 3822.999999999995 instead of 3823.00
To solve this issue we need to use Math.round function
Solution:
Multiply the number by 1000, round it and then divide by 1000. This will give the expected result.
Math.round(1000 * 38.23 * 100) / 1000
Hope this solves the multiplication issue present in javascript and also your time.
No comments:
Post a Comment