---
epic: 6
story: 6.2
title: "Logarithmic & Exponential Functions"
status: draft
---

## Epic 6 — Advanced Math & Functions
**Goal:** Scientific, financial, and power-user math.

### Story 6.2: Logarithmic & Exponential Functions

As a **CalcPad user**,
I want to use logarithmic and exponential functions including ln, log, log2, exp, pow, sqrt, cbrt, and nth-root,
So that I can perform scientific, financial, and engineering calculations involving growth, decay, and roots.

**Acceptance Criteria:**

**Given** the user writes `ln(1)`
**When** the engine evaluates
**Then** the result is `0`

**Given** the user writes `ln(e)` where `e` is Euler's number
**When** the engine evaluates
**Then** the result is `1`

**Given** the user writes `log(100)`
**When** the engine evaluates
**Then** the result is `2` (base-10 logarithm)

**Given** the user writes `log2(256)`
**When** the engine evaluates
**Then** the result is `8`

**Given** the user writes `exp(1)`
**When** the engine evaluates
**Then** the result is approximately `2.71828` (e^1)

**Given** the user writes `2^10`
**When** the engine evaluates
**Then** the result is `1024`

**Given** the user writes `pow(2, 10)`
**When** the engine evaluates
**Then** the result is `1024`

**Given** the user writes `e^3`
**When** the engine evaluates
**Then** the result is approximately `20.0855`

**Given** the user writes `sqrt(144)`
**When** the engine evaluates
**Then** the result is `12`

**Given** the user writes `cbrt(27)`
**When** the engine evaluates
**Then** the result is `3`

**Given** the user writes an nth-root expression such as `4th root of 625` or `root(625, 4)`
**When** the engine evaluates
**Then** the result is `5`

**Given** the user writes `ln(0)` or `log(-1)`
**When** the engine evaluates
**Then** the engine displays an error indicating the argument is out of the valid domain

**Given** the user writes `sqrt(-4)`
**When** the engine evaluates
**Then** the engine displays an error (complex numbers are out of scope unless explicitly supported)
