valueWhen

infix fun Number.valueWhen(percentage: Percentage): Double(source)

Calculates the base value of this number for the given Percentage. This method helps to answer the question: "5 is 20% of what number?" Example:

5.of(Percentage(20)) // 25.0 as 5 is 20% of 25

Or using the infix notation:

5 of 20.percent()

Receiver

Number

Return

The number that this number represents as the given Percentage.

Parameters

percentage

The Percentage value that this number represents.

Throws

When the Percentage value is zero.