@Serializable {
simple=true
collection=false
}
Decimal is used to represent a decimal floating point more precisely than a Float. Decimal is the preferred numeric type for financial applications.
Slots
- absSource
-
Decimal abs()
Return the absolute value of this decimal. If this value is positive then return this, otherwise return the negation.
- compareSource
-
Overrides sys::Obj.compare
Compare based on decimal value, scale is not considered for equality (unlike equals).
- decrementSource
-
Decimal decrement()
Decrement by one. Shortcut is --a or a--.
- defValSource
-
const static Decimal defVal
Default value is 0.
- divSource
-
Divide this by b. Shortcut is a/b.
- equalsSource
-
override Bool equals(Obj? obj)
Overrides sys::Obj.equals
Return true if same decimal with same scale.
- fromStrSource
-
static Decimal? fromStr(Str s, Bool checked := true)
Parse a Str into a Decimal. If invalid format and checked is false return null, otherwise throw ParseErr.
- hashSource
-
override Int hash()
Overrides sys::Obj.hash
Return platform specific hashcode.
- incrementSource
-
Decimal increment()
Increment by one. Shortcut is ++a or a++.
- maxSource
-
Return the larger of this and the specified Decimal values.
- minSource
-
Return the smaller of this and the specified Decimal values.
- minusSource
-
Subtract b from this. Shortcut is a-b.
- modSource
-
Return remainder of this divided by b. Shortcut is a%b.
- multSource
-
Multiply this with b. Shortcut is a*b.
- negateSource
-
Decimal negate()
Negative of this. Shortcut is -a.
- plusSource
-
Add this with b. Shortcut is a+b.
-
new privateMake()
Private constructor.
- toCodeSource
-
Str toCode()
Get this Decimal as a Fantom code literal.
- toLocaleSource
-
Str toLocale(Str? pattern := null)
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. - toStrSource
-
override Str toStr()
Overrides sys::Obj.toStr
Get string representation.