Div.n

From AGI Wiki
Jump to: navigation, search

The div.n command divides a variable by a number.

Syntax

div.n(var vA, byt B);
vA = vA / B;
vA /= B;

Remarks

The results of the division are rounded down (i.e. the result is truncated).

Note that this command uses the 'dot' notation (i.e. div.n vs. divn) unlike the original set of mathematical commands.

Possible Errors

AGI does not check for a divide by zero error. If an attempt is made to divide by zero, AGI will crash. Don't do it. EVER. You have been warned.

Example

Code:
v50 = 85;
div.n(v50, 5); [  v50 == 17
v50 /= 5;      [ now v50 == 3

Technical Information

Required Interpreter Version: Available in version 2.411 and above.
Byte-Code Value: 167 (0xA7 hex)

See Also

Mathematical Commands
div.v