const classcamAxonPlugin::Number

sys::Obj
  camAxonPlugin::Number

@Js
@Serializable { simple=true }

Number represents a numeric value and an optional Unit.

abs

Source

Number abs()

Return absolute value of this number.

approx

Source

Bool approx(Number that, Float? tolerance := null)

Return if this number is approximately equal to that - see sys::Float.approx

compare

Source

virtual override Int compare(Obj that)

Compare is based on val. Throw UnitErr is this and b have incompatible units.

decrement

Source

@Operator
Number decrement()

Decrement this number. Shortcut is --a.

div

Source

@Operator
Number div(Number b)

Divide this by b. Shortcut is a/b. The resulting unit is derived from the quotient of this and b. Throw UnitErr if a/b does not match a unit in the unit database.

equals

Source

virtual override Bool equals(Obj? that)

Equality is based on val and unit. NaN is equal to itself (like Float.compare, but unlike Float.equals)

fromStr

Source

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

Parse from a string according to zinc syntax

hash

Source

virtual override Int hash()

Hash is based on val

increment

Source

@Operator
Number increment()

Increment this number. Shortcut is ++a.

isInt

Source

Bool isInt()

Is this number a whole integer without a fractional part

isNaN

Source

Bool isNaN()

Is the floating value NaN.

isSpecial

Source

Bool isSpecial()

Return if this number if pos/neg infinity or NaN

lower

Source

Number lower()

Get the ASCII lower case version of this number as a Unicode point.

make

Source

new make(Float val, Unit? unit := null)

Construct from scalar value and optional unit.

makeDuration

Source

new makeDuration(Duration dur, Unit? unit := @hr)

Construct from a duration, standardize unit is hours If unit is null, then a best attempt is made based on magnitude.

makeInt

Source

new makeInt(Int val, Unit? unit := null)

Construct from scalar integer and optional unit.

makeNum

Source

static Number makeNum(Num val, Unit? unit := null)

Construct from scalar Int, Float, or Decimal and optional unit.

max

Source

Number max(Number that)

Return max value

min

Source

Number min(Number that)

Return min value

minus

Source

@Operator
Number minus(Number b)

Subtract b from this. Shortcut is a-b. The b.unit must match this.unit.

mod

Source

@Operator
Number mod(Number b)

Return remainder of this divided by b. Shortcut is a%b. The unit of b must be null.

mult

Source

@Operator
Number mult(Number b)

Multiple this and b. Shortcut is a*b. The resulting unit is derived from the product of this and b. Throw UnitErr if a*b does not match a unit in the unit database.

nan

Source

const static Number nan := Number.<ctor>(Float.nan)

negInf

Source

const static Number negInf := Number.<ctor>(Float.negInf)

negOne

Source

const static Number negOne := Number.<ctor>(-1.0)

negate

Source

@Operator
Number negate()

Negate this number. Shortcut is -a.

one

Source

const static Number one := Number.<ctor>(1.0)

plus

Source

@Operator
Number plus(Number b)

Add this with b. Shortcut is a+b. Throw UnitErr is this and b have incompatible units.

posInf

Source

const static Number posInf := Number.<ctor>(Float.posInf)

ten

Source

const static Number ten := Number.<ctor>(10.0)

toCode

Source

Str toCode()

Trio/zinc code representation, same as toStr

toDuration

Source

Duration? toDuration(Bool checked := true)

Get this number as a Fantom Duration instance

toFloat

Source

Float toFloat()

Get the scalar value as an Float

toInt

Source

Int toInt()

Get the scalar value as an Int

toLocale

Source

Str toLocale(Str? pattern := null)

Format the number according to sys::Float.toLocale pattern language. Unit symbol is always added as suffix if available.

toStr

Source

virtual override Str toStr()

String representation

unit

Source

Unit? unit()

Get unit associated with this number or null.

upper

Source

Number upper()

Get the ASCII upper case version of this number as a Unicode point.

zero

Source

const static Number zero := Number.<ctor>(0.0)