Here is my calculator: https://codepen.io/jmarkell/full/Ldoxvr/
I think I caught most of the errors, but I am sure I missed some. Let me know if you can break it.
I want to figure out how to get the keypad working with each button on the calculator, but I am not quite sure how to go about binding events for click and keyboard efficiently. And I have determined I really suck at design and picking color schemes.
Well anyway, any feedback you can provide will be greatly appreciated. Thanks for taking a look!
Edit: This link is now updated to the fixed site.
Issue #1) I should be able to click the following and get 1
1/3=*3
Instead I get 0.9999
Issue #2) I should be able to click the following and get 0.3
0.1+0.2 =
Instead I get 2.1
I did not look at your code, but I believe the above result occurs because you probably only allow 1 decimal point during a series of operations before = is clicked.
Issue #3) I should be able to click the following and clear out all entries (showing a 0)
3+5+8 ← ← ← ← ←
Instead I get 3 + 5 + displayed
Issue #4) I should not be able to enter the following, but I can.
*
9*
9*
9*
9
Issue #5) I should not be able to enter the following, but I can.
.3.3.6.6
There are probably more issues, but this you give you something to work on for now.
Thanks for the feedback! I believe I have fixed all the issues other than 1. My new calculator is here: https://codepen.io/jmarkell/full/vRwyGX/
I am forced to wonder how I should go about solving issue #1 since there should always be some error when dealing with floating point numbers.
You need to come up with a strategy to round the number and some level of precision.
Alright, I fixed the division by zero error and another error I found when you hit = and then type a number.
Revision 3 is here: https://codepen.io/jmarkell/full/Ldoxvr/
I’ll work on updating my rounding function tomorrow. Thanks for the help!
I cant seem to add or subtract by a two digit number after getting a result. 5+5=
returns 10 but if I try to add 65 to that it clears and displays 5
as the beginning of a new equation.
Also I can’t use negative numbers.
Yep, I see that error now. I’m going to work on it some more tomorrow. I’m missing too many little things and my brain’s dead. Thanks for finding it!
I think I fixed it now. Also, this calculator is not setup for negative numbers.
Alright, it now takes care of issue 1. Apparently the problem is that I went ahead and tried to do the rounding for the calculator. If I keep full precision, the javascript already handles it correctly.
Thank you all for feedback. If you find anything else that is not working please let me know!