Arithmetic operators in DataWindow expressions

When you write an expression, you can use the following arithmetic operators:

Table 1-5: Using expressions with arithmetic operators

Operator

Meaning

Example

+

Addition

SubTotal + Tax

-

Subtraction

Price - Discount

*

Multiplication

Quantity * Price

/

Division

Discount / Price

^

Exponentiation

Rating ^ 2.5

Multiplication and division

Multiplication and division are carried out to full precision (16–18 digits). Values are rounded:

Table 1-6: Value rounding in DataWindow expressions

Expression

Value

20.0/3

6.666666666666667

3*(20.0/3)

20

Truncate(20.0/3,4)

6.6666

Calculations with null

When you form an arithmetic expression that contains a null value, the expression becomes null. Thinking of null as undefined makes this easier to understand. For example, when a null column is multiplied by 5, the entire expression also evaluates to null. Use the IsNull function to explicitly check for the null value.

Boolean expressions that contain a null value evaluate to false rather than to null. For more information, see “Relational operators in DataWindow expressions”.