MATH

Performs mathematical operations in any base from 2 to 50, or convert from one base to another.

Syntax

MATH(argument1, operator, arguments2, [inbase, outbase, charset])

Arguments

Argument Description Default
argument1 First value to be used. None
operator Mathematical operator to be applied on the two values. Valid characters include (+ - * / ) . None
argument2 Second value to be used. None
[inbase] The numeric inbase, in the range 2 to 50 16 16
[outbase] The numeric outbase, in the range 2 to 50 16 16
[charset] The character set to use as a basis for computing the calculation. This string should contain the number of characters used by argument1 and argument2. 0–9,

uppercase A–Z

Results

Result Description
Return argument1 and argument2 would be converted to regular integer after charset operation is applied, then the result would be converted to the outbase.
%%RC One of the following:
-2 / was used and argument2 was 0.
-1 Invalid operator was used.
0 No error.
1 string contains characters not contained in the charset.
2 invalid index in the charset.

Examples

Function Call Return %%RC
MATH('8', '+', '8', 16, 16, ) 10 0
MATH('ABC', '/', 'DF', 16, 16, ) 12 0
MATH('ABC', '+', 'B', , ,'123456789') 0 1