Project Calculator hopefully bug free!

Here is the pen:

I know the style is not perfect but I have spent a lot of time trying to get the functionality right.
I appreciate your help.

  • JB

PS. Had to get rid of a couple more bugs. Should be nearly there now.

2+2= gives 4/2 gives 3. There seems to be an issue with chaining operations. Seems to be particularly with “/”

One thing that would be nice to implement: right now just pressing a number over and over allows me to overflow the #outputFormula element, and even though you go to scientific notation, it’s possible to generate an answer long enough to overflow that as well. See http://forum.freecodecamp.com/t/how-to-prevent-overflow-in-responsive-design/46666 --I wound up going the easy route described there (http://codepen.io/AbdiViklas/pen/GjdrZQ?editors=0010). One other little bug: I’m not sure which line of code is responsible, but while I can start an operation by typing “.”, as in “0.2”, I can’t do so after an operator; I have to type “0.”

1 Like

I get 2.6666. Can you provide a screenshot. My calculator uses BODMAS.

Yes I know about this minus issue. You can type something like 0.-2 and it treats it as -2.

The overflow I don’t know what you mean. When I tested it the numbers stayed inside the window.
Screenshot?
I may revisit it to clean up those last few bugs but I’ve spent so much time already, I want to move on to something else. Imagine spending 6 months developing 1 calculator and telling a prospective employer that’s all you did in that time! :neutral_face:

I mean:

Seriously, who is going to put that into a pocket, non scientific calculator?

There’s a saying in computer science.
“Rubbish in = rubbish out”