--- epic: 6 story: 6.1 title: "Trigonometric Functions" status: draft --- ## Epic 6 — Advanced Math & Functions **Goal:** Scientific, financial, and power-user math. ### Story 6.1: Trigonometric Functions As a **CalcPad user**, I want to evaluate trigonometric functions including sin, cos, tan, and their inverses and hyperbolic variants, So that I can perform scientific and engineering calculations directly in CalcPad. **Acceptance Criteria:** **Given** the angle mode is set to radians (default) **When** the user writes `sin(3.14159)` (approximately pi) **Then** the result is approximately `0` (within floating-point tolerance) **Given** the angle mode is set to degrees **When** the user writes `sin(90)` **Then** the result is `1` **Given** the user writes `sin(45°)` with the degree symbol **When** the engine evaluates the expression **Then** the engine treats the argument as degrees regardless of the global angle mode setting **And** the result is approximately `0.7071` **Given** the engine is in radians mode **When** the user writes `cos(0)` **Then** the result is `1` **Given** the user writes `tan(45°)` **When** the engine evaluates **Then** the result is approximately `1` **Given** the user writes `asin(1)` in radians mode **When** the engine evaluates **Then** the result is approximately `1.5708` (pi/2) **Given** the user writes `acos(0.5)` in degrees mode **When** the engine evaluates **Then** the result is `60` (degrees) **Given** the user writes `atan(1)` in degrees mode **When** the engine evaluates **Then** the result is `45` **Given** the user writes `sinh(1)` **When** the engine evaluates **Then** the result is approximately `1.1752` **Given** the user writes `cosh(0)` **When** the engine evaluates **Then** the result is `1` **Given** the user writes `tanh(0)` **When** the engine evaluates **Then** the result is `0` **Given** the user writes `sin(x)` where `x` is out of domain for an inverse trig function (e.g., `asin(2)`) **When** the engine evaluates **Then** an error is displayed indicating the argument is out of the valid domain **Given** the user wants to switch angle modes **When** the user sets the mode via a configuration directive (e.g., `angle mode: degrees`) **Then** all subsequent trig evaluations use the selected mode until changed again