A powerful interactive CLI calculator that just works.
NexusCalc - because sometimes you need to calculate things and your brain said "no."
- โ 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
python -m pip install nexuscalcpython -m pip install nexuscalc==3.2.0b2from nexuscalc import start_calc
start_calc()Or using the wrapper:
from nexuscalc import nexuscalc
nexuscalc.start_calc()Or after installation, just run:
nexuscalcfrom nexuscalc import readme
readme()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 120While 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 |
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
# ==================================================NEXUSCALC > 11
Enter a number
NEXUSCALC > 5
==================================================
๐ Calculation #2
==================================================
5! = 120
==================================================
NEXUSCALC > 9
Enter the number
NEXUSCALC > 8
Enter the root (n)
NEXUSCALC > 3
==================================================
๐ Calculation #3
==================================================
ยณโ8 = 2.0
==================================================
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.| 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 | Status | Changes |
|---|---|---|
| 3.2.0b2 | ๐ BETA | Fixed README inclusion, readme() function |
| 3.2.0b1 | ๐ 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() |
Run tests:
python -m pytest tests/ -vRun tests with coverage:
python -m pytest tests/ --cov=src/nexuscalcnexuscalc/
โโโ 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
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
MIT License - see the LICENSE file for details.
Light Bulb Experiments ยฉ 2026
- Built with โ and โค๏ธ
- Inspired by the need for a simple, powerful CLI calculator
- Thanks to all users who made this better
If you find NexusCalc useful, please consider:
- โญ Starring the repository on GitHub
- ๐ Reporting issues
- ๐ก Suggesting features
- ๐ง Contributing code
Made with โค๏ธ by Light Bulb Experiments