A simple CLI calculator for quick math.
Project description
Mathematical Expression Evaluator (math-evaluate)
By mhasanali2010
PyPI project link
https://pypi.org/project/math-evaluate
About the project
A simple command-line calculator for quick math without leaving the terminal.
Installation
Install using:
pip install math-evaluate
Usage
Example usage:
math "10*(5-2)^2 / 3"
Output: RESULT: 30
Testing
- Unittests have been included in
./tests.py - Running tests:
- Clone the repository:
git clone https://github.com/mhasanali2010/math-evaluate
- Navigate to the repository:
cd math-evaluate
- Run the tests:
python tests.py
- Clone the repository:
Notes
- Supported operators: +, -, *, /, (, ), ^
- This evaluator follows BODMAS/PEMDAS.
- Division and multiplication are evaluated left to right, same for addition and subtraction.
- Exponent associativity is supported.
- Use brackets () if you want to force evaluation order.
- Requires
Python 3.10or later. - Argument Parsing might glitch when using
zshif you try to evaluate an expression which contains-(.- If this happens then run the script using:
math --eval="<expression>"
- If this happens then run the script using:
- The CLI command is installed as
math.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
math_evaluate-0.1.5.tar.gz
(4.5 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file math_evaluate-0.1.5.tar.gz.
File metadata
- Download URL: math_evaluate-0.1.5.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a62f0b274cfec0a0d1c04545b75a0974cf96cb8dd0d3e59a681543221168b328
|
|
| MD5 |
ed21e52d3c836c5a32653d4d271d65bf
|
|
| BLAKE2b-256 |
25c7bffca31fabacc78ee381682a981bcfc4ca9b219c7f79c6277855d2e3c42b
|
File details
Details for the file math_evaluate-0.1.5-py3-none-any.whl.
File metadata
- Download URL: math_evaluate-0.1.5-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e69be3a55d9af4a2837fd8aa267d5e176d4b66bdd9f0dee6e7a0867ea5826f2b
|
|
| MD5 |
69cb13d035e89ff96489239d09bb87b7
|
|
| BLAKE2b-256 |
8dc2b940a841538312f0c90fb7897af5803016bc8e3fa19351db0fc6b243011f
|