๐ข A chill CLI calculator that just works
Project description
๐ข NexusCalc
A powerful interactive CLI calculator that just works.
NexusCalc - because sometimes you need to calculate things and your brain said "no."
[!CAUTION] Beta Version Warning This is a beta release (3.2.0-beta). Features may be unstable or change before the stable release. For production use, please install the latest stable version (3.0.0).
โจ Features
- โ Addition - Add two numbers
- โ Subtraction - Subtract second from first
- โ๏ธ Multiplication - Multiply two numbers
- โ Division - Divide first by second (with zero division error handling)
- ๐ Floor - Floor division (integer result)
- ๐ข Modulo - Remainder after division
- โก Exponent - Raise first number to the power of second
- โ Square Root - Square root of a number
- โฟโ Nth Root - Nth root of a number
- ๐ข Percentage - Calculate percentage of a number
- โ Factorial - Factorial of a number
- ๐ข Floating-point precision - 0.1 + 0.2 = 0.3 (we fixed it!)
- ๐ก๏ธ Error handling - Division by zero? We got you
- โจ๏ธ Regex quit patterns -
q,Q,quit,QUIT,12 - ๐ Calculation counter - Track your math history
- ๐จ Beautiful formatting - Clean, color-coded output
- ๐ก Built-in help - Type
horhelpfor documentation - ๐ง Keyboard interrupts - Ctrl+C gracefully handled
[!NOTE] New in 3.2.0-beta
- Added Percentage operation (option 10)
- Added Factorial operation (option 11)
- Quit moved to option 12
- Added
readme()function for easy documentation access
๐ฆ Installation
Stable Version (Recommended)
python -m pip install nexuscalc
Beta Version (For Testing)
python -m pip install nexuscalc==3.2.0-beta
[!WARNING] The beta version may contain bugs. Please report any issues on GitHub.
๐ Usage
Interactive Mode (Recommended)
from nexuscalc import start_calc
start_calc()
Or using the wrapper:
from nexuscalc import nexuscalc
nexuscalc.start_calc()
Or after installation, just run:
nexuscalc
Read the README from Terminal
from nexuscalc import readme
readme()
Programmatic Usage
from nexuscalc.core.operations import Operations
ops = Operations()
# Basic operations
result = ops.add(5, 3) # Returns 8
result = ops.subtract(10, 4) # Returns 6
result = ops.multiply(3, 4) # Returns 12
result = ops.divide(10, 2) # Returns 5.0
# Advanced operations
result = ops.floor_divide(10, 3) # Returns 3
result = ops.modulo(10, 3) # Returns 1
result = ops.exponent(2, 3) # Returns 8 (2^3)
result = ops.square_root(16) # Returns 4.0 (โ16)
result = ops.nth_root(8, 3) # Returns 2.0 (ยณโ8)
result = ops.percentage(20, 100) # Returns 20.0
result = ops.factorial(5) # Returns 120
๐ฎ Interactive Commands
While using the calculator, you can type:
| Command | Action |
|---|---|
1 |
Add โ |
2 |
Subtract โ |
3 |
Multiply โ๏ธ |
4 |
Divide โ |
5 |
Floor ๐ |
6 |
Modulo ๐ข |
7 |
Exponent โก |
8 |
Square Root โ |
9 |
Nth Root โฟโ |
10 |
Percentage % |
11 |
Factorial ! |
12, q, Q, quit, QUIT |
Exit calculator |
h, help, ? |
Show help |
Ctrl+C |
Cancel current operation |
Ctrl+D |
Exit calculator |
๐ Examples
Percentage Example
from nexuscalc import start_calc
# Example session:
# ==================================================
# ๐ข NEXUSCALC - Powerful Calculator
# ==================================================
#
# 1. Add โ
# 2. Subtract โ
# 3. Multiply โ๏ธ
# 4. Divide โ
# 5. Floor ๐
# 6. Modulo ๐ข
# 7. Exponent โก
# 8. Square Root โ
# 9. Nth Root โฟโ
# 10. Percentage %
# 11. Factorial !
# 12. Quit ๐ช
#
# Use 1-12
# NEXUSCALC > 10
# Enter the percentage
# NEXUSCALC > 20
# Enter the number
# NEXUSCALC > 100
#
# ==================================================
# ๐ Calculation #1
# ==================================================
# 20% of 100 = 20.0
# ==================================================
Factorial Example
NEXUSCALC > 11
Enter a number
NEXUSCALC > 5
==================================================
๐ Calculation #2
==================================================
5! = 120
==================================================
Nth Root Example
NEXUSCALC > 9
Enter the number
NEXUSCALC > 8
Enter the root (n)
NEXUSCALC > 3
==================================================
๐ Calculation #3
==================================================
ยณโ8 = 2.0
==================================================
๐ก๏ธ Error Handling
NexusCalc handles errors gracefully:
# Even root of negative number
NEXUSCALC > 9
Enter the number
NEXUSCALC > -8
Enter the root (n)
NEXUSCALC > 2
โ Error: Cannot take even root of a negative number!
# Factorial of negative number
NEXUSCALC > 11
Enter a number
NEXUSCALC > -5
โ Error: Factorial is not defined for negative numbers!
# Division by zero
NEXUSCALC > 4
Enter first number
NEXUSCALC > 10
Enter second number
NEXUSCALC > 0
โ Division Error: Cannot divide by zero!
๐ก Hint: You cannot divide by zero. Please try a different number.
[!IMPORTANT] Factorial Limitation Factorial is only defined for non-negative integers up to 100 to prevent overflow.
๐ Why NexusCalc?
| Feature | NexusCalc | Other Calculators |
|---|---|---|
| CLI Interface | โ | โ |
| Error Handling | โ | โ ๏ธ |
| Regex Quit Patterns | โ | โ |
| Floating Point Precision | โ | โ ๏ธ |
| Built-in Help | โ | โ |
| Calculation Counter | โ | โ |
| Keyboard Interrupts | โ | โ |
| Beautiful Output | โ | โ |
| Modulo Operation | โ | โ ๏ธ |
| Exponent Operation | โ | โ ๏ธ |
| Square Root Operation | โ | โ ๏ธ |
| Nth Root Operation | โ | โ |
| Percentage Operation | โ | โ ๏ธ |
| Factorial Operation | โ | โ ๏ธ |
๐ Version History
| Version | Status | Changes |
|---|---|---|
| 3.2.0-beta | ๐ BETA | Added Percentage, Factorial, Quitโ12 |
| 3.0.0 | โ STABLE | Added Nth Root, Quitโ10 |
| 2.6.0 | โ STABLE | Added Square Root, Quitโ9 |
| 2.5.0 | โ STABLE | Added Exponent, Quitโ8 |
| 2.1.0 | โ STABLE | Added Modulo, Quitโ7 |
| 2.0.0 | โ STABLE | Removed calculate(), start_calc() only |
| 1.1.0 | โ STABLE | Added start_calc() |
| 1.0.0 | โ STABLE | Initial release |
[!CAUTION] Version 3.2.0-beta is a pre-release. Please test and report any issues before the stable release.
๐งช Development
Run tests:
python -m pytest tests/ -v
Run tests with coverage:
python -m pytest tests/ --cov=src/nexuscalc
๐ Project Structure
nexuscalc/
โโโ src/nexuscalc/
โ โโโ core/ # Core calculator logic
โ โโโ parsers/ # Expression parsing
โ โโโ evaluator/ # Expression evaluation
โ โโโ utils/ # Utilities and helpers
โ โโโ exceptions/ # Custom exceptions
โโโ tests/ # Unit tests
โโโ examples/ # Usage examples
โโโ setup.py # Package setup
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
๐ License
MIT License - see the LICENSE file for details.
๐ค Author
Light Bulb Experiments ยฉ 2026
๐ Acknowledgments
- Built with โ and โค๏ธ
- Inspired by the need for a simple, powerful CLI calculator
- Thanks to all users who made this better
โญ Show Your Support
If you find NexusCalc useful, please consider:
- โญ Starring the repository on GitHub
- ๐ Reporting issues
- ๐ก Suggesting features
- ๐ง Contributing code
Made with โค๏ธ by Light Bulb Experiments
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 nexuscalc-3.2.0b1.tar.gz.
File metadata
- Download URL: nexuscalc-3.2.0b1.tar.gz
- Upload date:
- Size: 19.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05b751466b03899126819d741e3356e879dffb54356c165d04fb95b8db502f1c
|
|
| MD5 |
00a95787f3274cf06c991a89669f58ff
|
|
| BLAKE2b-256 |
827400c112d0e4d4e87fec0a55e2303da5c2c92ec94bff9491b0e09f400c6583
|
File details
Details for the file nexuscalc-3.2.0b1-py3-none-any.whl.
File metadata
- Download URL: nexuscalc-3.2.0b1-py3-none-any.whl
- Upload date:
- Size: 18.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3720f24995c6fda748e29b093548ff6222e0f4ad97e58e571c1c16f38e5eae5
|
|
| MD5 |
cc668b9d335c12dbbceb706b1b958ea8
|
|
| BLAKE2b-256 |
4acb6f8e33fadaa620596c529d8a1921021714719c2ab29b6ce85a47badf381b
|