Files
calctext/_bmad-output/implementation-artifacts/6-7-rounding-functions.md
2026-03-16 19:54:53 -04:00

1.6 KiB

epic, story, title, status
epic story title status
6 6.7 Rounding Functions draft

Epic 6 — Advanced Math & Functions

Goal: Scientific, financial, and power-user math.

Story 6.7: Rounding Functions

As a CalcPad user, I want rounding functions including natural-language "round to nearest" and standard floor/ceil/round, So that I can control numeric precision in my calculations.

Acceptance Criteria:

Given the user writes round 21 up to nearest 5 When the engine evaluates Then the result is 25

Given the user writes round 22 down to nearest 5 When the engine evaluates Then the result is 20

Given the user writes round 23 to nearest 5 When the engine evaluates Then the result is 25 (standard rounding: 23 is closer to 25 than 20)

Given the user writes floor(3.7) When the engine evaluates Then the result is 3

Given the user writes floor(-3.2) When the engine evaluates Then the result is -4 (floor rounds toward negative infinity)

Given the user writes ceil(3.2) When the engine evaluates Then the result is 4

Given the user writes ceil(-3.7) When the engine evaluates Then the result is -3 (ceil rounds toward positive infinity)

Given the user writes round(3.456, 2) When the engine evaluates Then the result is 3.46 (rounded to 2 decimal places)

Given the user writes round(3.456, 0) When the engine evaluates Then the result is 3

Given the user writes round(2.5) When the engine evaluates Then the result is 3 (round half up, or the chosen rounding convention is documented)