Calculator project - feedback request

Calculator project - feedback request
0.0 0

#1

Hi everyone, I have completed a fairly solid working draft of my work on the calculator project.

My calculator is here:

Any and all constructive feedback would be much appreciated.

Kind regards,
Ben


#2

0.7 + 0.1 should be 0.8 and not 0.79999

1 / 7 * 7 should be 1 and not 0.99995

How would I enter -4 + 5 to get 1?

Also, did you mean to allow the multiple clicks of the same operator to combine the last result with itself? For example, if I enter 5 + + + + =, I get 80. Since you do not offer a way for the user to back up or show what operators have already been applied to the last number, I would suggest not allowing consecutive operators (+, *, / *, or -) to be pressed.


#3

Thanks for the feedback, randelldawson,

I wonder what causes 0.7 + 0.1 to result in 0.79999? Is this a known js issue?

When I key in 1 / 7 * 7 = I do get 1.

When I key in - 4 + 5 = I do get 1.

I did NOT mean to allow multiple clicks of the same operator to combine the last result with itself. That is actually a feature calculators (used to, at least) have, but it was not intended in this case. I’ll get on it.


#4

Take a look at the following thread and the links referenced in the first reply. This is not just a JS problem.


#5

I was wrong, but I will say that it would be good if it would show the - before the 4 when I first type it. I could not tell it was actually taking it. It does not show up until I hit the + operator. It is just a little confusing.

I meant, 1 / 7 = and then * 7 = results in 0.79999 The display may be limited in what it shows, but the calculation in the background should account round to 1 on this calculation.


#6

Hi randelldawson, I read and searched until blue in the face for a couple of days. Could not find a good solution to all the issues like 0.1 + 0.2 = 0.30000000004, 0.3 - 0.1 = 0.1999999999 etc., except fixing num of decimal places arbitrarily and/or rounding up (again arbitrarily and with truncation). FINALLY I found big.js and this was a nice fix for those.

However it does not fix 1 / 7 = and then * 7 = results in 0.9999999999 even with big.js. So I’m asking - Is there even a fix for this?

(I note that the example calculator given for the FreeCodeCamp project has all these same issues.)

Thanks