The Integer type deals with signed, countable integer numbers.
Class Methods (see Type)
- biggest
- Returns the value of the largest possible positive integer: 2**29 - 1.
- New
- Converts a float, symbol or Text value into an integer, if possible. Otherwise, it returns null.
Instance Methods
Most binary methods will coerce a passed Float value to integer before performing the method. No limit checking is performed (e.g., multiplying two very large integers could overflow, returning a truncated, incorrect value). Null is returned if the requested computation makes no sense (e.g., divide by zero).
- -@
- Negate the integer (flip its sign)
- +
- Add two integers
- -
- Subtract two integers
- *
- Multiply two integers
- /
- Divide two integers
- %
- Return the remainder after dividing two integers (7%2 returns 1)
- **
- self to the power of the second integer (2**3 returns 8)
- <=>
- Compare two integers. Return -1 if self is less, 1 if greater, and 0 if equal. Return null if not comparable.
- Abs
- Absolute value (-1).Abs returns 1.
- And
- Boolean bit-oriented and
- Char
- Return a Text value containing a single UTF-8 unicode character whose code is the integer.
- integer?
- Return true if self is an integer, otherwise 'null'.
- Float
- Convert to a float and return.
- Max
- Return the larger integer. (5).Max(2) returns 5.
- Min
- Return the smaller integer. (2).Min(-4) returns -4.
- Next
- Return the next integer, essentially adding 1 to it.
- Not
- Boolean bit-oriented not
- Or
- Boolean bit-oriented or
- Shl
- Bitwise shift to the left. (3).Shl(2) returns 12.
- Shr
- Bitwise shift to the right. (3).Shr(1) returns 1.
- Sign
- Return 1 if positive, -1 if negative.
- Text
- Convert to new Text value and return.
- Xor
- Boolean bit-oriented xor