You are here: Using Condition Tables and the Record Dictionary > Using the Record Dictionary > Setting Up the Record Dictionary > RPN Function

RPN Function

The RPN (Reverse Polish Notation) function handles mathematical operations in the Record Dictionary. The RPN function is used as a parameter of a variable in the Record Dictionary. Use Reverse Polish Notation to express your equation. Any variables that are referenced must be previously defined in the Record Dictionary.

Use the format:

RPN(valid RPN equation)

A valid RPN equation can include: variables, numeric constants, arithmetic operators (+,-,*,/,%), and several functions (MOD, ABS, DUP, SWAP, POW, SQRT, CEIL, FLOOR). When using a function, place a ‘#’ sign before the function name (example: #MOD). This distinguishes a function name from a variable name.

RPN can also be used with date format variables. This can be useful when adding to a date or calculating an age. Here are some examples:

RPN or Reverse Polish Notation is an arithmetic method that performs calculations from left to right. A stack is created to hold numeric values until an operation is performed. For instance, a simple equation such as “ 1 + 2 ” would be represented as “ 1 2 + ”. During computation, the stack would first hold “1”, then it would be given “2”. When the “+” is reached, the “1” and “2” are taken off the stack and added together. A slightly more complicated equation such as “ (1 + 2 ) * 5 “ would be represented as “ 1 2 + 5 * ”.

Note No parentheses are needed in RPN logic.

Available RPN functions

These are the available functions in RPN. When using them, remember to place a “#” sign in front of the function name. This distinguishes a function name from a variable name.

Function

Description

ABS

References the most recent value and returns the absolute value of that number.

CEIL

Returns the next largest integer value of a number (round up).

DUP

Creates a duplicate of the top value in the stack.

FLOOR

Returns the next smallest integer value of a number (round down).

MAX

Compares the top two values on the stack and returns the larger.

MIN

Compares the top two values on the stack and returns the smaller.

MOD

Performs a division with the top two values on the stack and returns the remainder.

POW

Removes the top two values in the stack. Calculates the first to the power of the second.

SQRT

Returns the square root of the number.

SWAP

Removes the top two values in the stack and replaces them in reverse order.