type
Decimal
src
@Serializable { simple=true }
const class Decimal : Num
Decimal is used to represent a decimal floating point more precisely than a Float. Decimal is the preferred numeric type for financial applications.
constructors
fromStr |
Parse a Str into a Decimal. |
---|
fields
defVal |
Default value is 0. |
---|
methods
abs |
Return the absolute value of this decimal. |
---|---|
compare |
Compare based on decimal value, scale is not considered for equality (unlike |
decrement |
Decrement by one. |
div |
Divide this by b. |
divFloat |
Divide this by b. |
divInt |
Divide this by b. |
equals |
Return true if same decimal with same scale. |
hash |
Return platform specific hashcode. |
increment |
Increment by one. |
max |
Return the larger of this and the specified Decimal values. |
min |
Return the smaller of this and the specified Decimal values. |
minus |
Subtract b from this. |
minusFloat |
Subtract b from this. |
minusInt |
Subtract b from this. |
mod |
Return remainder of this divided by b. |
modFloat |
Return remainder of this divided by b. |
modInt |
Return remainder of this divided by b. |
mult |
Multiply this with b. |
multFloat |
Multiply this with b. |
multInt |
Multiply this with b. |
negate |
Negative of this. |
plus |
Add this with b. |
plusFloat |
Add this with b. |
plusInt |
Add this with b. |
toCode |
Get this Decimal as a Fantom code literal. |
toLocale |
Format this decimal number for the current locale. |
toStr |
Get string representation. |
Slot Details
abs
compare
decrement
defVal
div
divFloat
divInt
equals
fromStr
hash
increment
max
min
minus
minusFloat
minusInt
mod
modFloat
modInt
mult
multFloat
multInt
negate
plus
plusFloat
plusInt
toCode
toLocale
src
Str toLocale(Str? pattern := null, Locale locale := Locale.cur())
Format this decimal number for the current locale. If pattern is null, then the locale's default pattern is used. See Float.toLocale
for pattern language and examples.