ratio Of
Creates a Percentage based on the ratio of this number and other number. Calculations using it won't be rounded. Example:
1.ratioOf(5) // 20%
Or using the infix notation:
1 ratioOf 5
Receiver
Return
A Percentage that represents the ratio of this number and the other number.
Parameters
The other number.
See also
Throws
When other is zero.
Creates a Percentage based on the ratio of this number and other number. Calculations using it will be rounded. Example:
1.ratioOf(5, 2) // 20%
Receiver
Return
A Percentage that represents the ratio of this number and the other number.
Parameters
The other number.
The precision scale to round percentage calculations. The rounding is done using the PreciseRounding policy (i.e. rounds using RoundingMode.HALF_EVEN mode).
See also
Throws
When other is zero.
Creates a Percentage based on the ratio of this number and other number. Calculations using it will be rounded. Example:
1.ratioOf(5, Rounding.to(2, RoundingMode.HALF_DOWN)) // 20%
Receiver
Return
A Percentage that represents the ratio of this number and the other number.
Parameters
The other number.
The Rounding strategy to round the percentage calculations.
See also
Throws
When other is zero.