Numbers math pct change
Exactnumbers_math_pct_changeDeterministic and authoritative — the canonical answer for this input.
Return (new - old) / old as a fraction plus display string. Negative when decreasing. Rejects old=0.
Parameters
oldnumberrequirednewnumberrequiredCall it
curl -X POST https://api.snipget.ai/v1/numbers/math/pct-change \
-H "Authorization: Bearer sk_live_..." \
-H "Content-Type: application/json" \
-d '{"old":100,"new":120}'Example response
{
"fraction": 0.2,
"display": "20.00%",
"old": 100,
"new": 120
}FAQ
What does percent change tell me?
It measures how much a value moved from a starting point to an ending point, as a share of the start. Going from 100 to 120 is a 20% increase; going from 120 to 100 is about a 17% decrease. It is directional, so the order matters.
How is this different from percent difference?
Percent change has a clear before and after (old then new) and can be negative. Percent difference is order-independent and compares two values with no notion of which came first. Use change for growth or trends over time, difference for comparing two measurements.
Does it handle decreases?
Yes. A drop returns a negative fraction, for example old 120 to new 100 gives roughly -0.17, shown as '-16.67%'.
Is the result exact?
Yes, it is a deterministic calculation. The fraction is returned in full precision and a two-decimal display string is included for convenience.
What if the old value is zero?
Percent change is undefined when the starting value is zero, so you get a result flagged is_valid false with a why_invalid reason and confidence 0, not an error.