Calculator App accepts a rich variety of expression formats beyond simple arithmetic. From natural language phrases likeDocumentation 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.
9 squared to algebraic equations like 2x+4=10, this page documents every form of input the REPL understands, with examples drawn directly from the source.
Arithmetic Operators
All standard arithmetic operators are supported. Expressions are evaluated using Python’seval under a restricted safe dictionary, so standard operator precedence applies.
| Operator | Meaning | Example | Result |
|---|---|---|---|
+ | Addition | 3+2 | 5 |
- | Subtraction | 10-4 | 6 |
* | Multiplication | 3*4 | 12 |
/ | Division | 15/3 | 5.0 |
** | Exponentiation | 2**3 | 8 |
^ | Exponentiation (alias) | 2^3 | 8 |
The
^ operator is automatically rewritten to ** before evaluation. Both forms produce identical results.Fractions
Calculator App parses fraction notation and converts it to Python’sfractions.Fraction type internally, giving exact rational arithmetic rather than floating-point approximations.
Simple fractions use the standard a/b notation:
Natural Language
Calculator App understands a set of English phrases and rewrites them into standard expressions before evaluation. The transformation is case-insensitive.| Natural language phrase | Rewrites to | Example input | Result |
|---|---|---|---|
{n} squared | ({n})**2 | 9 squared | 81 |
{n} cubed | ({n})**3 | 5 cubed | 125 |
sqrt of {n} | sqrt({n}) | sqrt of 16 | 4.0 |
square root of {n} | sqrt({n}) | square root of 25 | 5.0 |
sqrt {n} | sqrt({n}) | sqrt 16 | 4.0 |
Natural language phrases only match literal numbers in the expression (e.g.,
9 squared). To square a variable or sub-expression, use ** or ^ directly.Variables
The evaluator maintains a variable store that is injected into every expression before evaluation. Variable values are substituted as raw string replacements, so a stored value of5 turns every occurrence of the variable name into the literal string 5 before eval runs.
Assigning a variable uses name=value syntax. Because any input containing both = and a letter is first routed to the equation solver (see Equations below), typing x=5 is handled as a one-variable equation and the solver returns the solution directly:
Equations
When the input contains= and at least one letter on the left-hand side, Calculator App routes the input to its equation solver rather than the standard evaluator.
Format: expression = value where the expression includes a single-letter variable.
Implicit multiplication — writing a digit immediately before a letter (e.g.,
2x) is automatically expanded to 2*x by the solver before evaluation. You do not need to write the * explicitly in equation expressions.* operator) but no exponentiation (**2), and falls back to a brute-force integer search over the range −100,000 to 100,000. The search returns the first integer solution found; if an equation has multiple solutions only one result is reported.
The solver finds only the first matching integer in the search range. For
x^2-4=0 the brute-force scan encounters x = -2 before x = 2 and returns that single result.Math Functions
The following functions and constants are available in any expression. They live in the evaluator’s safe dictionary and map directly to Python’smath module.
| Name | Description | Example | Result |
|---|---|---|---|
sqrt(x) | Square root | sqrt(25) | 5.0 |
sin(x) | Sine (radians) | sin(0) | 0.0 |
cos(x) | Cosine (radians) | cos(0) | 1.0 |
tan(x) | Tangent (radians) | tan(0) | 0.0 |
log(x) | Natural logarithm | log(e) | 1.0 |
pi | π constant | pi | 3.14159… |
e | Euler’s number | e | 2.71828… |
Special Commands
Two special keywords are handled by the REPL before any expression parsing occurs.quit
Exits the Calculator App REPL immediately. No expression is evaluated.
meme
Toggles meme mode on or off. When meme mode is ON, certain iconic expressions return joke results instead of their real values (e.g.,
9+10 returns 21).