Any suggestions on refactoring my js? or general feedback?
When I enter 0.7 + 0.1 I expect to see 0.8 in the display. Your calculator displays the equivalent value in the display but it is expressed in scientific (exponential) notation as 8.000000e-1 It really should just show 0.8
Currently chalking this one up to something weird with JS behavior.
In the console:
.1+.2 //returns 0.30000000000000004 .4+.5 //returns 0.9 .7+.1 // returns 0.7999999999999999
What is that all about?
Take a look at the following thread and the links referenced in the first reply. This is not just a JS problem.
Resolved this with math.js, referenced in one of the links. Too bad computers don’t speak base-10, or too bad they don’t have infinite memory.
Thanks for going through it with a fine-tooth comb and providing a nice guide to the answer, @randelldawson Really appreciate the thorough feedback/help.