Feedback on calulator project

Please give me some feedback on that calculator (react-redux) project:
https://codepen.io/DaSci2018/full/vPbvJR

There are so many things that can go wrong depending on user input.
I’m not sure whether I catched all that things.

  • Display is limited to 14 digits so 99999999999999 plus 1 will give incorrect result
  • classic 0.1 + 0.2 rounding error :slight_smile:
  • minus, decimal, equals will error; basically every time pressing equals when there is only decimal on the screen will error in console. But calculator doesn’t break :+1:

Also for projects that contain more than a couple of classes I’d recommend using something like codesandbox.io where you can split your code into separate files and make it easier to read (I was scratching my head thinking “where does StackHelper come from?”).

Overall good job. I rarely see here such a robust calculator.

1 Like

Wow! Looks beautiful.
Maybe add some color?

1 Like

Greats hints, I’ll fix that mistakes. (When I first saw the calculator-userstories, I thought: this is easy… haha)

codesandbox.io is cool, I didn’t know that site. A complete react-project can be created with one click.
Thanks!

I’m a bit afraid of getting a “Google”-color-style. Maybe I’ll try a monochrome style.
Thanks

Thanks for tip on codesandbox.io , one button click and up and running
with React app, just Great!

You still need to solve rule 13. The sequence “5 * - 5” = should produce an output of “-25” . This also will expect code to handle 5-+5= ; ans = 10.
Do appreciate the time you took to produce the grid layout and react auto generation of your buttons along with the React-Redux Store.
To pass the test that is failing I would refine your calc stack and use Regex Tests to manage your calc expressions before returning a result. The stack will need to be able to handle more that on operation of course. Operation *- is allowed *-+ should reduce to +. A nice challenge. Will help develop your Regex skills. I used this tool to aid with testing my Regex expressions. https://regex101.com/r/uJ0nJ2/1

1 Like

Thanks for the feedback. When I made the project (it’s a while ago) all tests passed. Maybe they changed the rules.
If I type the sequence: “5 * - 5 [=]” in my good old Texas-Instruments-Calculator, I get: 0 and not -25.
To get -25, Texas Instruments needs the following sequence: 5 * 5 [sign-button] [=]. My Windows-Calculator behaves the same way.

Maybe I’ll change that to pass the test, I’m not quite sure.