Please critique my calculator!

I’ve just finished the calculator challenge! Please test to see if it works in your browser, and tell me what you like and dislike :slight_smile:

Here it is

First of all, really nice design! 2 things I noticed:

  1. You can enter multiple decimal points if you click an operator. Try to do this: 0.2+.1
  2. Floating point error. Try to do this: 0.2*0.1

EDIT: Didn’t see it at first, but changing style is a super awesome feature!

1 Like

hello,
i think your calculator is amazing, so i hope if you add another mathematical operators like % Binary operation ( exp: decimal to binary )

Thanks for finding these bugs, fixed it! 0.2 * 0.1 actually led me to researching JS and floating points and the issue with 0.1. I was wondering why it kept showing 0.020000000000000004 fixed it by if statements and forcing it to change to 0.02 lol.

Thank you :slight_smile: I want to add much more complicated operators to the calculator, not just %, but sin, cos, etc, but I think I need to get a bit better at JS first. Then I’ll improve all projects!

I like it, didnt test very carefully the functionality, but i asume you did :wink: Can you maybe make the color scheme disappear on click? it would seem reasonable, and it wont be much code: once the color is chosen and I know i wont change it again, let me click the button again to turn off the panel for choice.
Nice design.

yes, you must to learn JS and how to create and return value from functions like factorial ect… .
if you need some help i’m here.

Hey, there are still some cases in which you get an odd result. Maybe you should use something like this:

var result = whateverYouCalculate; result = Math.round(result * 10000000000)/10000000000; // rounds to 10 decimal places

BTW I can guarantee you that adding more complex functions is extremely time consuming. I finished my calculator yesterday, with over 650 lines of JS.

I tried something like that but it used .toFixed() instead. I like your idea, seems smarter than separately overriding every result.

And oh dear that calculator! I thought mine was complicated enough at ~300 lines!

1 Like

Done! Good idea thanks :slight_smile: