i have doing a cash register program and i came up with a problems of Penny 0.01
lets say i have given a penny 0.03999779 when i try
let a=0.03999779
Math.round(a)
returns 0 but i want to return
0.04
i have doing a cash register program and i came up with a problems of Penny 0.01
lets say i have given a penny 0.03999779 when i try
let a=0.03999779
Math.round(a)
returns 0 but i want to return
0.04
A good link about this topic here:
Use Math.round(num * 100) / 100
or Math.round((num + 0.00001) * 100) / 100