Variación porcentual
percent-changeCalcula la variación porcentual entre un valor anterior y uno nuevo. Cuándo: un resultado numérico tiene que ser exacto o reproducible y no estimado. No para: calcular el p% de un valor y el valor aumentado o disminuido en p% (percent-of). Efectos secundarios: ninguno (solo lectura, sin red, sin estado guardado). Determinista: la misma entrada da la misma salida. Límites: entrada JSON de hasta 64 KB, 1 s por llamada, resultado de hasta 1 MB.
EN: Computes the percentage change from an old value to a new value ((new − old) / |old| × 100) and the absolute difference. When: a numeric result has to be exact or reproducible instead of estimated. Not for: computing p% of a value, and optionally the value increased or decreased by p% (percent-of). Side effects: none (read-only, no network access, no stored state). Deterministic: the same input gives the same output. Limits: JSON input up to 64 KB, 1 s per call, result up to 1 MB.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| to | Yes | New value (number; required). | |
| from | Yes | Old value (number; required). | |
| decimals | No | Decimals (integer; optional; default 4; min 0; max 12). |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| direction | No | ||
| difference | No | ||
| percent_change | No |