PercentDifference

(Function Library)

Description: Returns the percentage difference between two numbers
Returns: Numeric
Usage: Script or steady state.
Function Groups: General Math
Related to:  
Format: \FunctionLib.PercentDifference(Value1, Value2)
Parameters:  
Value1
The first numeric value.
Value2
The second numeric value.
Comments:

This module is a member of the Function Library, and must therefore be prefaced by \FunctionLib as shown in the "Format" section.

Performs the following calculation:

Return(Abs(Value1 - Value2)/Value2);

Example:

\FunctionLib.PercentDifference(50, 100)

Will return 0.50

The calculation is the percentage of the difference between the two parameters, not the first parameter as a percent of the second. Division is always by the second parameter, therefore it should usually be the larger of the two values.

\FunctionLib.PercentDifference(25, 100)

Will return 0.75

\FunctionLib.PercentDifference(100, 25)

Will return 3