Integer Type

The Integer primitive type represents the set of positive and negative whole numbers in the range -2,147,483,648 through 2,147,483,647. Any value of the Integer primitive type is therefore a whole number.

JADE defines a number of arithmetic operations that take integer operators and return integer results, as listed in the following table.

Operand Description
+ Add
- Subtract
* Multiply
div Integer division (division with truncation; for example, 7 div 3 = 2)
^ Exponentiation (for example, i ^ 3 is i cubed)
mod Modulus (remainder after integer division)

These are binary (or dyadic) infix operators; that is, they are used with two operands written on each side of the operator (for example, a+b). However, the + operator and - operator can also be used as unary (or monadic) prefix operators, as listed in the following table

Unary Prefix Operator Description
+a Sign identify
-a Sign inversion

The div operator (integer division) performs division with truncation; for example, 7 div 3 = 2.

An integer variable can contain any whole number in the range -2,147,483,648 through 2,147,483,647.

The following table lists valid operations for the Integer primitive type.

Expression Expression Type
integer-expression + date-expression (date)
integer-expression + time-expression (time)

You can use the JadeEditMask class and TextBox class getTextAsInteger and setTextFromInteger methods to handle locale formatting for numeric fields.

For details about the methods defined in the Integer primitive type, see "Integer Methods", in the following subsection. For details about converting primitive types, see "Converting Primitive Types", in Chapter 1 of the JADE Developer’s Reference.