Calculator App supports all fundamental arithmetic operations directly from the terminal prompt. Expressions are evaluated using Python’sDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Seaus-tech/Calculator-App/llms.txt
Use this file to discover all available pages before exploring further.
eval with a restricted namespace, so operator precedence follows standard Python rules — parentheses first, then exponentiation, then multiplication and division, then addition and subtraction.
Supported Operators
| Operator | Symbol(s) | Example | Result |
|---|---|---|---|
| Addition | + | 2+3 | 5 |
| Subtraction | - | 10-4 | 6 |
| Multiplication | * | 3*4 | 12 |
| Division | / | 15/3 | 5 |
| Exponentiation | ^ or ** | 2^3 or 2**3 | 8 |
Exponentiation: ^ and **
Both caret (^) and double-asterisk (**) are accepted as exponentiation operators. Before evaluation, evaluator.py uses a regex substitution to convert any ^ into ** so Python’s eval can process it:
2^3 and 2**3 produce identical results.
Operator Precedence
Calculator App uses standard Python operator precedence. No configuration is needed — expressions are evaluated exactly as a Python interpreter would evaluate them.Precedence order (highest to lowest)
Precedence order (highest to lowest)
- Parentheses —
(2+3)*4→20 - Exponentiation —
2**3+1→9 - Multiplication / Division —
3*4+2→14 - Addition / Subtraction —
10-4+2→8
Integer vs Float Results
The type of result returned depends on the operands and the operation:- Integer result — when both operands are integers and the operation produces a whole number (e.g.,
2+3→5,3*4→12). - Float result — when division is involved or the result is non-integer (e.g.,
15/3→5.0in Python 3,7/2→3.5).
Error Handling
Division by Zero
Returns
Invalid - Division by zero when a denominator evaluates to 0.Syntax Error
Returns
Invalid - Syntax error for malformed expressions like 2++3.