Libraries.Language.Types.Number Documentation

The Number class is the object representation of the primitive type number.

Example Code

class Main
action Main
   number age = 15.5
   Number result = test(age)
end
action test(Number num) returns Number
     return num
end
end

Inherits from: Libraries.Language.Object

Actions Documentation

Compare(Libraries.Language.Object object)

This action compares two object values and returns an integer. The compare result is either larger if this hash code is larger than the object passed as a parameter, smaller, or equal.

Parameters

Return

integer: The Comprare result, Smaller (-1), Equal (0), or Larger (1).

Example

Number o
Number t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smaller)

Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their values.

Parameters

Return

boolean: True if the values are equal and false if they are not equal.

Example

Number o
Number t
boolean result = o:Equals(t)

GetHashCode()

This action gets the hash code for an object. In this case, GetHashCode is overriden and matches the integer value of the equivalent primitive in the Java programming language.

Return

integer: The integer hash code of the object.

Example

Object o
integer hash = o:GetHashCode()

GetHex()

This action gets the hex representation of the number value.

Return

text: The hex representation of the number.

Example

number i = 3
text result = i:GetHex()

GetInteger()

This action gets the value from the number object and casts it to an integer.

Return

integer: The value of the object converted to an integer.

Example

Number age
integer result = age:GetInteger()

GetMaximumValue()

This action gets the maximum number value, (2-2^-52)*2^1023.

Return

number: The maximum number value.

Example

number i = 3.5
output i:GetMaximumValue()

GetMinimumPositiveValue()

This action gets the minimum number value (4.9e-324). This is the smallest possible positive number.

Return

number: The minimum number value.

Example

number i = 3.5
output i:GetMinimumPositiveValue()

GetMinimumValue()

This action gets the minimum negative number value (-1.7976931348623157E308).

Return

number: The minimum number value.

Example

number i = 3.5
output i:GetMinimumValue()

GetNegativeInfinityValue()

This action gets the negative infinity of a number value(0xfff0000000000000L).

Return

number: Negative infinity of a number value.

Example

number i = 3.5
output i:GetNegativeInfinityValue()

GetNotANumberValue()

This action gets the not-a-number representation of a number value.

Return

number: The Not-a-Number of a number value.

Example

number i = 3.5
output i:GetNotANumberValue()

GetNumberOfBits()

This action gets the number of bits representing a number value.

Return

integer: The number of bits of a number value.

Example

number i = 3.5
output i:GetNumberOfBits()

GetPositiveInfinityValue()

This action gets the positive infinity number value(0x7ff0000000000000L).

Return

number: The positive infinity of a number.

Example

number i = 3.5
output i:GetPositiveInfinityValue()

GetText()

This action gets the value from the number object and casts it to a text value.

Return

text: The value of the object converted to text.

Example

Number age
text result = age:GetText()

GetValue()

This action gets the value from the number object.

Return

number: The value of the object.

Example

Number age
number result = age:GetValue()

IsInfinite()

This action returns true if the number is infinite.

Return

boolean: True if the number is infinitely large and false if it is not.

Example

number i = 333.999999999999999999
boolean result = i:IsInfinite()

IsNotANumber()

This action returns true if the number is not a number(NaN).

Return

boolean: True if NaN.

Example

number i = 3.5
boolean result = i:IsNotANumber()

SetValue(number i)

This action sets the value of the number object.

Parameters

  • number i: The number value.

Example

Number age
age:SetValue(15.5)