Percent

world.money.pricing$package.Percent
object Percent

Factories and application for Percent.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Percent.type

Members list

Value members

Concrete methods

def apply(value: Int): Percent
def apply(value: BigDecimal): Percent
inline def apply(value: Double): Percent
inline def apply(value: Float): Percent
def margin[C <: Currency & Singleton](cost: Money[C], price: Money[C], scale: Int, mode: Rounding): Either[Undefined, Percent]

The margin a price carries - (price - cost) / price - as a percentage figure rounded to scale places by mode. Undefined at zero price.

The margin a price carries - (price - cost) / price - as a percentage figure rounded to scale places by mode. Undefined at zero price.

Attributes

def markup[C <: Currency & Singleton](cost: Money[C], price: Money[C], scale: Int, mode: Rounding): Either[Undefined, Percent]

The markup a price represents over a cost - (price - cost) / cost - as a percentage figure rounded to scale places by mode (the quotient need not terminate, so the boundary is named). The complement of margin: the two are named apart because confusing them is a real pricing bug class. Undefined at zero cost.

The markup a price represents over a cost - (price - cost) / cost - as a percentage figure rounded to scale places by mode (the quotient need not terminate, so the boundary is named). The complement of margin: the two are named apart because confusing them is a real pricing bug class. Undefined at zero cost.

Attributes

def of[C <: Currency & Singleton](p: Percent, m: Money[C]): Money[C]

Exact application, read as commerce does: Percent(16).of(total).

Exact application, read as commerce does: Percent(16).of(total).

Attributes

Givens

Extensions

Extensions

extension (p: Percent)
def fraction: BigDecimal
def of[C <: Currency & Singleton](m: Money[C]): Money[C]
def value: BigDecimal

The percentage figure, so Percent(16).value is 16, in plain form at every magnitude.

The percentage figure, so Percent(16).value is 16, in plain form at every magnitude.

Attributes