Skip to main content

Documentation 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.

Calculator App exposes a curated set of mathematical functions and constants that you can use in any expression. These are injected into the evaluation sandbox via the safe_dict in evaluator.py, making them available by name without any import or prefix.

Available Functions and Constants

NameTypeDescriptionExample
sqrt(x)FunctionSquare root of xsqrt(16)4.0
sin(x)FunctionSine of x (radians)sin(0)0.0
cos(x)FunctionCosine of x (radians)cos(0)1.0
tan(x)FunctionTangent of x (radians)tan(0)0.0
log(x)FunctionNatural logarithm of xlog(e)1.0
piConstantπ ≈ 3.141592653589793pi3.141592653589793
eConstantEuler’s number ≈ 2.718281828459045e2.718281828459045

Usage Examples

> sqrt(16)
= 4.0

> sin(pi/2)
= 1.0

> cos(0)
= 1.0

> tan(0)
= 0.0

> log(e)
= 1.0

> pi
= 3.141592653589793

> e
= 2.718281828459045

Combining Functions with Operators

Functions return numeric values and can be composed with any operator or other function:
> sqrt(9) + sqrt(16)
= 7.0

> sin(pi/6) * 2
= 1.0

> log(e**3)
= 3.0

> cos(pi)
= -1.0

Trigonometry and Degree Conversion

All trigonometric functions (sin, cos, tan) accept angles in radians, not degrees. To convert degrees to radians, multiply by pi / 180:
> sin(90 * pi / 180)
= 1.0

> cos(60 * pi / 180)
= 0.5000000000000001

Security Sandbox

__builtins__ is set to an empty dict ({}) in the safe_dict passed to eval. This disables all built-in Python functions — only the explicitly listed functions and constants above are accessible. Attempts to call anything else (e.g., open(), print(), __import__) will return Invalid - Math error or Invalid - Unknown variable.
The relevant portion of evaluator.py:
safe_dict = {
    '__builtins__': {},
    'sqrt': math.sqrt,
    'sin':  math.sin,
    'cos':  math.cos,
    'tan':  math.tan,
    'log':  math.log,
    'pi':   math.pi,
    'e':    math.e,
    'Fraction': Fraction,
}

Build docs developers (and LLMs) love