harsh98trivedi / Simple-JavaScript-Calculator

Simple JavaScript Calculator by Harsh Trivedi
https://harsh98trivedi.github.io/Simple-JavaScript-Calculator/
MIT License
169 stars 165 forks source link

JS Floating point number precision issue #38

Open ZigaoWang opened 4 months ago

ZigaoWang commented 4 months ago

There is floating point number precision issue in this calculator which is a problem from the JS. For example: 0.1+0.2=0.30000000000000004 You can round it to 0.3 You can check out this page: https://stackoverflow.com/questions/1458633/how-can-i-deal-with-floating-point-number-precision-in-javascript Other than that, this calculator is absolutely cool! Thank you for your hard work!

Nani-14 commented 4 months ago

0.1 is the error

ZigaoWang commented 4 months ago

@Nani-14 What do you mean? Thx

ZigaoWang commented 3 months ago

@harsh98trivedi Can you take a look? Thank you so much!