percent

Creates a Percentage based on this number. Calculations using it won't be rounded.

Receiver

Number

Return

The Percentage value of this number.


infix fun Number.percent(precision: Int): Percentage(source)

Creates a Percentage based on this number. Calculations using it will be rounded.

Receiver

Number

Return

The Percentage value of this number.

Parameters

precision

The precision scale to round percentage calculations. The rounding is done using the PreciseRounding policy (i.e. rounds using RoundingMode.HALF_EVEN mode).


infix fun Number.percent(rounding: Rounding): Percentage(source)

Creates a Percentage based on this number. Calculations using it will be rounded.

Receiver

Number

Return

The Percentage value of this number.

Parameters

rounding

The Rounding strategy to round the percentage calculations.


Creates a Percentage based on a number returned by the lambda function. Calculations using it won't be rounded.

Receiver

(() -> Number)

Return

A Percentage.


fun () -> Number.percent(precision: Int): Percentage(source)

Creates a Percentage based on a number returned by the lambda function. Calculations using it will be rounded.

Receiver

(() -> Number)

Return

A Percentage.

Parameters

precision

The precision scale to round percentage calculations. The rounding is done using the PreciseRounding policy (i.e. rounds using RoundingMode.HALF_EVEN mode).


fun () -> Number.percent(rounding: Rounding): Percentage(source)

Creates a Percentage based on a number returned by the lambda function. Calculations using it will be rounded.

Receiver

(() -> Number)

Return

A Percentage.

Parameters

rounding

The Rounding strategy to round the percentage calculations.