Percent Change
percent_changeCompute the exact percent change from a starting to an ending value, returning decimal, direction, and multiplier while correctly handling negative bases.
Instructions
Exact percent change from FROM_VALUE to TO_VALUE. Use percentage, not this, for PART / TOTAL rather than a before/after change.
(to_value - from_value) / abs(from_value) * 100 — the conventional
finance definition, relative to the MAGNITUDE of the base so a negative
from_value does not flip the sign (see note when it applies). Refuses
from_value=0 (undefined) rather than returning infinity — report the
absolute change instead. Returns percent_exact (exact rational),
percent_decimal (rounded), absolute_change, direction
("increase"/"decrease"/"unchanged"), and multiplier (to_value /
from_value, exact).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to_value | Yes | Ending value: a number or exact rational (e.g. '3/4', '1e3'), not an expression like '2*3'; no '_' digit separators | |
| from_value | Yes | Starting value: a number or exact rational (e.g. '3/4', '1e3'), not an expression like '2*3'; no '_' digit separators; must not be zero |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||