calculate_percentage
Run one of four percentage calculations on two numbers. Returns JSON { operation, result } (plus unit: 'percent' for the 'change' operation). The meaning of value1 and value2 depends on the operation, so read their descriptions before calling. Exact arithmetic, no model involved, no rounding applied. Ratios and general expressions are not supported.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| value1 | Yes | For 'of', the percentage itself (25 means 25%). For 'increase' and 'decrease', the base amount being adjusted. For 'change', the original value. Must be a finite number. | |
| value2 | Yes | For 'of', the amount the percentage is taken from. For 'increase' and 'decrease', the percentage to apply (10 means 10%). For 'change', the new value. Must be a finite number. | |
| operation | Yes | Which calculation to run. 'of' = value1 percent OF value2. 'increase' = value1 raised BY value2 percent. 'decrease' = value1 reduced BY value2 percent. 'change' = the percentage change going FROM value1 TO value2, which errors when value1 is 0. Required; any other value is rejected. |