Method Deck / other

Percent of a value, or percent change between two values

Computes either a percentage of a base value, or the percent change from an old value to a new value.

Published for review. The Founder is checking every card himself; anything he strikes comes down the same hour.

Try it

Inputs

Outputs

Steps

  1. If operation is percent_of: result = base * percent / 100.
  2. If operation is percent_change: result = ((new_value - base) / base) * 100, expressed in percent.
  3. Round to 2 decimals.

Constants

None.

Sources

Worked example and test vectors

NameInputsAnswer
worked example{"operation":"percent_of","base":250,"percent":12}30.00
test vector: percent change{"operation":"percent_change","base":80,"new_value":100}25.00%

Published card