I assumed if the first number after the decimal is 5 or higher, it would rounds up
Here I'm calculating 5% of 31.5.
Problem #1
It shouldn't matter which operation happens first but it does
console.log((31.5 * 5)/100) // 1.575
console.log(31.5 * (5/100)) // 1.5750000000000002
Problem #2
When I round it to 2 decimal point I don't get the same
console.log(((31.5 * 5)/100).toFixed(2)) // 1.57
console.log((31.5 * (5/100)).toFixed(2)) // 1.58
Why 1.575 is not rounding up to 1.58?