const class sys::Decimal

sys::Obj
  sys::Num
    sys::Decimal

@Serializable { simple=true }

Source

Decimal is used to represent a decimal floating point more precisely than a Float. Decimal is the preferred numeric type for financial applications.

abs

Decimal abs()

Source

Return the absolute value of this decimal. If this value is positive then return this, otherwise return the negation.

compare

virtual override Int compare(Obj obj)

Source

Compare based on decimal value, scale is not considered for equality (unlike equals).

decrement

@Operator
Decimal decrement()

Source

Decrement by one. Shortcut is --a or a--.

defVal

const static Decimal defVal

Source

Default value is 0.

div

@Operator
Decimal div(Decimal b)

Source

Divide this by b. Shortcut is a/b.

divFloat

@Operator
Decimal divFloat(Float b)

Source

Divide this by b. Shortcut is a/b.

divInt

@Operator
Decimal divInt(Int b)

Source

Divide this by b. Shortcut is a/b.

equals

virtual override Bool equals(Obj? obj)

Source

Return true if same decimal with same scale.

fromStr

static new fromStr(Str s, Bool checked := true)

Source

Parse a Str into a Decimal. If invalid format and checked is false return null, otherwise throw ParseErr.

hash

virtual override Int hash()

Source

Return platform specific hashcode.

increment

@Operator
Decimal increment()

Source

Increment by one. Shortcut is ++a or a++.

max

Decimal max(Decimal that)

Source

Return the larger of this and the specified Decimal values.

min

Decimal min(Decimal that)

Source

Return the smaller of this and the specified Decimal values.

minus

@Operator
Decimal minus(Decimal b)

Source

Subtract b from this. Shortcut is a-b.

minusFloat

@Operator
Decimal minusFloat(Float b)

Source

Subtract b from this. Shortcut is a-b.

minusInt

@Operator
Decimal minusInt(Int b)

Source

Subtract b from this. Shortcut is a-b.

mod

@Operator
Decimal mod(Decimal b)

Source

Return remainder of this divided by b. Shortcut is a%b.

modFloat

@Operator
Decimal modFloat(Float b)

Source

Return remainder of this divided by b. Shortcut is a%b.

modInt

@Operator
Decimal modInt(Int b)

Source

Return remainder of this divided by b. Shortcut is a%b.

mult

@Operator
Decimal mult(Decimal b)

Source

Multiply this with b. Shortcut is a*b.

multFloat

@Operator
Decimal multFloat(Float b)

Source

Multiply this with b. Shortcut is a*b.

multInt

@Operator
Decimal multInt(Int b)

Source

Multiply this with b. Shortcut is a*b.

negate

@Operator
Decimal negate()

Source

Negative of this. Shortcut is -a.

plus

@Operator
Decimal plus(Decimal b)

Source

Add this with b. Shortcut is a+b.

plusFloat

@Operator
Decimal plusFloat(Float b)

Source

Add this with b. Shortcut is a+b.

plusInt

@Operator
Decimal plusInt(Int b)

Source

Add this with b. Shortcut is a+b.

toCode

Str toCode()

Source

Get this Decimal as a Fantom code literal.

toLocale

Str toLocale(Str? pattern := null, Locale locale := Locale.cur())

Source

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.

toStr

virtual override Str toStr()

Source

Get string representation.