Solving number multiplication issue in JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function multiplyTest() { | |
var x = ((0.1 * 100) * (0.2 * 100)) / 10000; | |
console.log(x); | |
//We are dividing here with 10000 because we multiplye 2 different numbers with 100 | |
//here console log statement will return exact answer 0.02 | |
} | |
multiplyTest(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment