https://github.com/tasxatzial/calculator
Arbitrary precision calculator. Supports term grouping.
https://github.com/tasxatzial/calculator
calculator calculator-javascript javascript-calculator
Last synced: 7 months ago
JSON representation
Arbitrary precision calculator. Supports term grouping.
- Host: GitHub
- URL: https://github.com/tasxatzial/calculator
- Owner: tasxatzial
- License: mit
- Created: 2023-05-09T21:32:15.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-02-28T12:47:03.000Z (8 months ago)
- Last Synced: 2025-02-28T19:05:31.721Z (8 months ago)
- Topics: calculator, calculator-javascript, javascript-calculator
- Language: JavaScript
- Homepage: https://tasxatzial.github.io/calculator/
- Size: 761 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Calculator
A simple calculator that supports the 4 basic operations on decimal numbers and grouping of terms using parentheses.
[Live version](https://tasxatzial.github.io/calculator/)
## Features
* Dark & light theme. The selected theme is restored when the page reloads.
* If the user has not selected a theme, the applied theme is always synchronized with the system theme.
* Calculations are saved in history and can be reloaded.
* History is restored when the page reloads.
* Keyboard input is supported.
* Arbitrary precision calculations with [decimal.js](https://github.com/MikeMcl/decimal.js).## Implementation
* Accessible + screen reader friendly.
* Variation of the [MVC](https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller) pattern (only for inputting expressions, performing calculations, and displaying the results).
* Expressions are calculated with the [Shunting yard algorithm](https://en.wikipedia.org/wiki/Shunting_yard_algorithm).## Dependencies
The project is written in HTML, CSS, JavaScript.
The following dependencies will be installed via `npm install`:
* [:focus-visible](https://github.com/WICG/focus-visible) polyfill.
* [decimal.js](https://github.com/MikeMcl/decimal.js).## Run locally
Run the development version:
```bash
npm run dev
```Build the project:
```bash
npm run build
```Build & serve the production version:
```bash
npm run serve
```## Tests
Vitest is used for testing.
Currently, only a basic set of tests has been written for the basic model operations, such as inputting and calculating expressions.
Run the tests:
```bash
npm run test
```or, if you prefer access to the browser UI:
```bash
npm run test:ui
```## Screenshots
See [screenshots](screenshots/).