mathLib.compareNum

The system function mathLib.compareNum returns a result (-1, 0, or 1) that indicates whether the first of two numbers is less than, equal to, or greater than the second.


mathLib.compareNum syntax diagram

result

Item defined as type INT or the following equivalent: type BIN with length 9 and no decimal places. This item receives one of the following values:

-1

numericItem1 is less than numericItem2.

0

numericItem1 is equal to numericItem2.

1

numericItem1 is greater than numericItem2.

numericItem1

Any numeric or HEX item, as described in Mathematical (system words).

numericItem2

Any numeric or HEX item, as described in Mathematical (system words).

Example

  myItem01 = 4
  myItem02 = 7

  result = mathLib.compareNum(myItem01,myItem02);

  // result = -1

Related reference
Mathematical (system words)