jitx/percentage¶
Package name: jitx/percentage
Summary¶
Percentage¶
The Percentage
type is an encapsulation of 0-100% scale
Constructors¶
Function | Description |
---|---|
Percentage | Constructor for defstruct Percentage |
Functions¶
Function | Description |
---|---|
almost-equal? | |
percentage (+ 4) | Consistent interface for defining a percentage value. |
Definitions¶
Percentage¶
The Percentage
type is an encapsulation of 0-100% scale
public defstruct Percentage <: Equalable & Hashable & Comparable
value: Double
value: Double
but typed to provide a consistent interface for all functions that reference percentages. For example, this can be used when specifying a component value precision.
Constructors¶
Percentage¶
Constructor for defstruct Percentage
public defn Percentage (value:Double)
Functions¶
almost-equal?¶
public defn almost-equal? (a:Percentage, b:Percentage, eps:Double) -> True|False
- Returns
True|False
percentage¶
Consistent interface for defining a percentage value.
public defn percentage (x:Double) -> Percentage
- Returns
Percentage
x
is in the domain 0 - 100 %.
If x = 0.1
this means 0.001% - not 10%
percentage¶
public defn percentage (x:Byte) -> Percentage
- Returns
Percentage
percentage¶
public defn percentage (x:Int) -> Percentage
- Returns
Percentage
percentage¶
public defn percentage (x:Long) -> Percentage
- Returns
Percentage
percentage¶
public defn percentage (x:Float) -> Percentage
- Returns
Percentage
Operators¶
minus -
¶
public defn minus (a:Percentage, b:Percentage) -> Percentage
- Returns
Percentage
negate -
¶
public defn negate (x:Percentage) -> Percentage
- Returns
Percentage
plus +
¶
public defn plus (a:Percentage, b:Percentage) -> Percentage
- Returns
Percentage
times *
¶
public defn times (a:Percentage, b:Percentage) -> Percentage
- Returns
Percentage
times *
¶
public defn times (a:Double, b:Percentage) -> Double
- Returns
Double
times *
¶
public defn times (a:Byte, b:Percentage) -> Byte
- Returns
Byte
times *
¶
public defn times (a:Int, b:Percentage) -> Int
- Returns
Int
times *
¶
public defn times (a:Long, b:Percentage) -> Long
- Returns
Long
times *
¶
public defn times (a:Float, b:Percentage) -> Float
- Returns
Float
Related Packages¶
Forwarded by package: jitx