Simple responsive arithmetic operations calculator. It uses bootstrap and custom CSS styles for page responsiveness, and mathjs pack to parse expressions and evaluate them.
In the project directory, you can run:
Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.
Builds the app for production to the build
folder.
Most of its behavior mimic a smatphone calculator, however some are not implemented yet, like blocking second decimal symbol click; instead it throws 'Syntax Error' when '=' is pressed.
The evaluation occurrs everytime an acumulated expression is validated and passed to mathjs
's evaluate
function.
-
Mathjs: extensive math library for JavaScript and Node.js. Every inputed expression via keypad buttons are internally validated in other to parse to 'evaluate' function from mathjs. Run
npm i mathjs
to install. -
Textfit: Fit headlines and paragraphs into any element. Both displayed and outputed expression use this to fit expression on display. Run
npm install react-textfit
to install.
Here are some proposed implementations.
- Add squareroot operation.
- Merge separators in a single button, just like Android's native calculator.
- Implement the unary '%' operator as a percentage of last term.
- What else?
E-mail me! or pull request.
- Vagner Bessa - Initial work - bessava
This project is licensed under the MIT License - see the LICENSE file for details
The header style comes from Bootstrap example - Album.