2021年3月7日星期日

Why is Microsoft Edge not calculating decimal numbers and equations properly?

Text

402.39 - 226.96 = 175.43

I took this screenshot from my MSE console. This is not complex calculations. I've been scratching my head into why my equations were not giving me the right numbers until I decided to try the equation in Edge's console to find out that the problem seems to be the Browser and not me.

Am I missing something, did I forget anything?

Since I could not figure out the problem in my code, I chose to hard code values in my variable and reduce my code to the plain minimum:

var ltotal = 402.39 - 226.96;  document.getElementById("txtotal").value = ltotal.toString();  

Initially, I thought I needed to round. But it's absolutely unecessary to round anything here. Clearly something is not correct or I missed something.

Is there a javascript rule I may have forgoten?

https://stackoverflow.com/questions/66523802/why-is-microsoft-edge-not-calculating-decimal-numbers-and-equations-properly March 08, 2021 at 11:00AM

没有评论:

发表评论