Decimal
- Last Updated: March 24, 2022
- 1 minute read
- Corticon
- Version 6.3
- Documentation
In this section, wherever the syntax includes <Number>, either Integer or Decimal data types may be used.
Corticon's Decimal 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>. |
|
| 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 Decimal 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.
|
|
| Exponent | |||
<Number1> **
<Number2> |
Number | Raises <Number1>
to the power of <Number2>. The
resulting data type is the more expansive of either <Number1> or <Number2>. See Precedence of rule operators. |
|
| Increment | |||
<Number1> +=
<Number2> |
Number | Increments <Number1> by <Number2>. The
data type of <Number1> must accommodate
the addition of <Number2>. See Precedence of rule operators. |
|
| Decrement | |||
<Number1> -=
<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 | |||
<Decimal>.absVal |
Decimal | Returns the absolute value of <Number>. If the <Number> is positive, <Number> itself is returned; if <Number> is negative, the negation of <Number> is returned. |
|
| Floor | |||
<Decimal>.floor |
Integer | Returns the largest (closest to positive infinity) Integer
that is not greater than <Number>. |
|
| Round | |||
<Decimal>.round |
Decimal | Rounds <Decimal>
to the nearest Integer. |
|
| Round(n) | |||
<Decimal>.round(<Integer>) |
Decimal | Rounds <Decimal>
to the number of decimal places specified by <Integer>. |
|
| To Integer | |||
<Decimal>.toInteger |
Integer | Converts an attribute of type Decimal to type Integer. Decimals will have the decimal point and fraction (those digits to the right of the decimal point) truncated. | |
| To String | |||
<Decimal>.toString |
String | Converts an attribute of type Decimal to type string | |
| Maximum Value | |||
<Decimal>.max(<Number>) |
Number | Returns the greater of <Decimal> and <Number>. |
|
| Minimum Value | |||
<Decimal>.min(<Number>) |
Number | Returns the lesser of <Decimal> and <Number>. |
|
| Logarithm (base 10) | |||
<Decimal>.log |
Decimal | Returns the logarithm (base 10) of <Decimal>. <Decimal> may not be zero. |
|
| Logarithm (base x) | |||
<Decimal1>.log(<Decimal2>) |
Decimal | Returns the logarithm (base <Decimal2>) of <Decimal1>. <Decimal1>
may not be zero. |
|
| Natural Logarithm | |||
<Decimal>.ln |
Decimal | Returns the logarithm (base e) of <Decimal>.<Decimal> may not be zero. |
|
| Random | |||
<Decimal>.random |
Decimal | Returns a random decimal between minRange and maxRange. |
|
| truncate | |||
<Decimal>.truncate |
Integer | Truncates "this" Decimal value to an integer by removing the fractional portion. | |
| fraction | |||
<Decimal>.fraction |
Decimal | Extracts the fraction portion of "this" Decimal. | |
| movePoint(places) | |||
<Decimal>.movePoint
(places:Integer) |
Decimal | Moves the Decimal value's point moved n places where n can be a positive (moves right) or negative (moves left) value. | |