Integer
- Last Updated: September 30, 2019
- 1 minute read
- Corticon
- Documentation
In this section, wherever the syntax includes <Number>, either Integer or Decimal data types may be used.
Corticon's Integer attribute operators are as follows:
| Name and Syntax | Returns | Description | |
|---|---|---|---|
| Equals (used as a comparison) | |||
<Number1> =
<Number2> |
Boolean | Returns a value of true if <Number1> is the same as <Number2>. |
|
| Equals (used as an assignment) | |||
<Number1> =
<Number2> |
Number | Assigns the value of <Number2> to the value of <Number1>. The data type of <Number1> must be expansive enough to accommodate
<Number2>. |
|
| Not Equal To | |||
<Number1>
<> <Number2> |
Boolean | Returns a value of true if <Number1> is not equal to <Number2>. |
|
| Less than | |||
<Number1> <
<Number2> |
Boolean | Returns a value of true if <Number1> is less than <Number2>. |
|
| Greater than | |||
<Number1> >
<Number2> |
Boolean | Returns a value of true if <Number1> is greater than <Number2>. |
|
| Less than or Equal to | |||
<Number1>
<= <Number2> |
Boolean | Returns a value of true if <Number1> is less than or equal to
<Number2>. |
|
| Greater than or Equal to | |||
<Number1>
>= <Number2> |
Boolean | Returns a value of true if <Number1> is greater than or equal to
<Number2>. |
|
| In (Range) | |||
attributeReference
in [ |(rangeExpression)|]
|
Boolean | Returns a value of true if attributeReference is in the range of Integer values
from..to,
and where opening and closing parentheses (
)indicate exclusion of that limit and square brackets
[ ] indicate inclusion of that
limit. |
|
| In (List) | |||
attributeReference
in {listExpression} |
Boolean | Returns a value of true if attributeReference is in the comma-delimited list of
literal values, defined enumeration values, or - if in use - enumeration
labels. |
|
| Add | |||
<Number1> +
<Number2> |
Number | Returns the sum of <Number1> and <Number2>. The resulting data type is the more expansive
of either <Number1> or
<Number2>. For example, if an
Integer value is added to a Decimal value, the resulting value will be a
Decimal. See Precedence of rule operators. |
|
| Subtract | |||
<Number1> -
<Number2> |
Number | Subtracts <Number2> from <Number1>. The resulting data type is the more expansive
of either <Number1> or
<Number2>. See Precedence of rule operators. |
|
| Multiply | |||
<Number1> *
<Number2> |
Number | Returns the product of <Number1> and <Number2>. The resulting data type is the more expansive
of either <Number1> or
<Number2>. See Precedence of rule operators.
|
|
| Divide | |||
<Number1> /
<Number2> |
Number | Divides <Number1> by <Number2>. The resulting data type is the more expansive
of either <Number1> or
<Number2>. See Precedence of rule operators.
|
|
| Increment | |||
<> += <Number2> |
Number | Increments <Number1> by <Number2>. The data type of <Number1> must accommodate the addition of <Number2>. See Precedence of rule operators.
|
|
| Decrement | |||
<> -= <Number2> |
Number | Decrements <Number1> by the value of <Number2>. The data type of <Number1> must accommodate the addition of <Number2>. See Precedence of rule operators.
|
|
| Absolute value. | |||
<Integer>.absVal |
Number | Returns the absolute value of <Integer>. If the <Integer> is positive, <Integer> itself is returned; if
<Integer> is negative, the
negation of <Integer> is
returned. |
|
| To Decimal | |||
<Integer>.toDecimal |
Decimal | Converts an attribute of type Integer to type Decimal. | |
| To String | |||
<Integer>.toString |
String | Converts an attribute of type Integer to type String. | |
| Maximum Value | |||
<Integer1>.max(<Integer2>) |
Integer | Returns the greater of <Integer1> and <Integer2>. |
|
| Minimum Value | |||
<Integer1>.min(<Integer2>) |
Integer | Returns the lesser of <Integer1> and <Integer2>. |
|
| Div | |||
<Integer1>.div(<Integer2>) |
Integer | Returns the whole number of times that <Integer2> fits within <Integer1> - any remainder is
discarded. |
|
| Mod | |||
<Integer1>.mod(<Integer2>) |
Integer | Returns the whole number remainder that results from
dividing <Integer1> by
<Integer2>. If the remainder
is a fraction, then zero is returned. |
|
| Logarithm (base 10) | |||
<Integer>.log |
Decimal | Returns the logarithm (base 10) of <Integer>. <Integer> may not be zero. |
|
| Logarithm (base x) | |||
<Integer>.log(<Decimal>) |
Decimal | Returns the logarithm (base <Decimal>) of <Integer>. <Integer> may not be zero. |
|
| Natural Logarithm | |||
<Integer>.ln |
Decimal | Returns the natural logarithm (base e) of
<Number>. <Integer> may not be zero. |
|
| Random | |||
<Integer>.random |
Integer | Returns a random integer between minRange and maxRange. |
|
| isProbablePrime(certainty) | |||
<Integer>.isProbablePrime
(certainty:Integer) |
Boolean | Returns true if this Integer is probably prime; false if definitely is not prime. | |
| gcd(val) | |||
<Integer>.gcd(val:Integer) |
Integer | Returns the greatest common divisor of the absolute
value of this and the absolute value
of val. |
|
| negate | |||
<Integer>.negate |
Integer | Returns the negative value of this integer. | |