Factory

object Factory(source)

A Percentage factory.

Functions

Link copied to clipboard
fun of(value: Number): Percentage

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

fun of(value: Number, rounding: Rounding): Percentage
fun of(value: Number, precision: Int): Percentage

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

Link copied to clipboard
fun ratioOf(number: Number, other: Number): Percentage

Creates a Percentage based on the ratio of two numbers. Calculations using it won't be rounded. Example:

fun ratioOf(number: Number, other: Number, rounding: Rounding): Percentage
fun ratioOf(number: Number, other: Number, precision: Int): Percentage

Creates a Percentage based on the ratio of two numbers. Calculations using it will be rounded. Example:

Link copied to clipboard
fun relativeChange(initial: Number, ending: Number): Percentage

Creates a Percentage which represents the relative change of an initial and ending numbers. Calculations using it won't be rounded. Example:

fun relativeChange(initial: Number, ending: Number, rounding: Rounding): Percentage
fun relativeChange(initial: Number, ending: Number, precision: Int): Percentage

Creates a Percentage which represents the relative change of an initial and ending numbers. Calculations using it will be rounded. Example: