|The HotDocs Computation Archive|
IF ROUND( ( NumVar-n / 2 ), 0 ) * 2 = NumVar-n TRUE ELSE FALSE END IF Alternative: IF ( NumVar-n / 2 ) = ROUND( ( NumVar-n / 2 ), 0 ) TRUE ELSE FALSE END IF
Both computations return TRUE or FALSE, where TRUE = even number, and FALSE = odd number.
An odd number divided by two will produce a decimal. If we trim the decimal off with ROUND and multiply the integer portion by two, it will be less than the original number. For example: 5 / 2 = 2.5. 2 * 2 = 4. Even numbers, on the other hand, will always equal the original number when put through the same formula: 4 / 2 = 2. 2 * 2 = 4.