LOTUSSCRIPT LANGUAGE


Arithmetic Operators
When an arithmetic expression contains a NULL operand, the expression as a whole evaluates to NULL.

For example:

Dim varV
Dim anInt%
varV = NULL
varV = varV ^ 2
' Test to see if varV is NULL.
Print IsNull (varV)
' Output: True
anInt% = 5
Print IsNull(varV * anInt%)
' Output: True

Only variables of type Variant may be assigned a value of NULL without causing an error.

This example is valid:

varV = NULL
varV = varV * 5

This example is not valid:

anInt% = anInt% * varV
' Generate an error.

When the result of an arithmetic operation is too large for the type of variable to which it is assigned, LotusScript automatically converts the data type, if possible, or an overflow error results.

Dim anInt As Integer
Dim aNumericV As Variant
aNumericV = 10000 ^ 10
Print aNumericV
' Output: 1E+40
Print TypeName(aNumericV)
' Output: DOUBLE
anInt% = 10000 ^ 10
' Generate an error.

LotusScript also rounds numbers when performing floating point division on integer operands:

aDouble# = 42.5
anInt% = 64
anInt% = anInt% / 7
Print anInt%
' Output: 9
' The Mod operator rounds its two operands to Integer
' expressions, divides the first Integer by the second,
' and returns the remainder.                    
Print aDouble# Mod anInt%
' Output: 6

For more information on data type conversion and rounding, see "Automatic data type conversion" in "Data Types, Constants, and Variables."

See Also