Mathematical Instructions


 

The arithmetic instructions perform the various PL/B mathematical functions. Except for the CALC instruction, they typically use the same general format.

 

ADD

Add two numbers with optional giving clause.

ARCCOS

Calculate the arccosine of a value.

ARCSIN

Calculate the arcsine of a value.

ARCTAN

Calculate the arctangent of a value.

ARCTAN2

Calculate the arctangent of a value returns a value in the range –pi to pi radians.

CALC

Perform algebraic type calculation.

CHECK10

Perform a check digit calculation.

CHECK11

Perform a check digit calculation.

COMPARE

Compare two numbers.

COS

Calculate the cosine of a value.

COSH

Calculate the hyperbolic cosine of a value.

DECR

Decrement a variable by one.

DIVIDE

Divide two numbers with optional giving clause.

EXP

Calculate the natural exponent of a value.

INCR

Increment a variable by one.

LOG

Calculate the natural log of a value.

LOG10

Calculate the base 10 log of a value.

MODULO

Determine the remainder of a division operation.

MULTIPLY

Multiply two numbers with optional giving clause.

NFORMAT

Format a numeric string.

POWER

Raise a value to a power.

ROTATELEFT

Left circular shift an integer.

ROTATERIGHT

Right circular shift an integer.

SHIFTLEFT

Left logical shift an integer.

SHIFTLEFTA

Left algebraic shift an integer.

SHIFTRIGHT

Right logical shift an integer.

SHIFTRIGHTA

Right algebraic shift an integer.

SIN

Calculate the sin of a value.

SINH

Calculate the hyperbolic sin of a value.

SQRT

Calculate the square root of a value.

SUBTRACT

Subtract two numbers with optional giving clause.

TAN

Calculate the tangent of a value.

TANH

Calculate the hyperbolic tangent of a value.

 

The arithmetic instructions use the Condition Flags: ZERO, LESS, and OVER. These flags are set or cleared depending on the results of the operation. They usually indicate the following:

 

Flag

Indication

ZERO

The result of the instruction was zero.

LESS

The result of the instruction was less than zero.

OVER

Significant digits were lost in the result

 

When the OVER Condition Flag is set, the LESS and ZERO condition indicators are unpredictable.

 

 



PL/B Language Reference ADD