Skip to content
Reference > Methods

percentChange(old,nuw)

Definition

Double percentChange(Number old, Number nuw)

Description

This method will use this formula, (nuw-old) / old, to obtain the result. Returns either the formula result or null if either argument is null. Returns NaN if either is negative or if both are zero.

Parameter Definition

Name Type Description
old Number first value, should be positive
nuw Number second value, should be positive

Examples

1
2
3
Double r1 = percentChange(10,15); // r1 == 0.5
Double r2 = percentChange(5,20); // r2 == 3.0
Double r3 = percentChange(-4,30); // r3 == -8.5