Difference between revisions of "Div.n"
From AGI Wiki
Jump to navigationJump to search (Created page with "The '''div.n''' command divides a variable by a number. == Syntax == div.n(var vA, byt B);<br /> vA = vA / B;<br /> vA /= B; == Remarks == The resu...") |
|||
Line 10: | Line 10: | ||
The results of the division are rounded down (i.e. the result is truncated). | 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 == | == Possible Errors == |
Latest revision as of 17:16, 11 April 2019
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:
<syntaxhighlight lang="agi"> v50 = 85; div.n(v50, 5); [ v50 == 17 v50 /= 5; [ now v50 == 3 </syntaxhighlight>
Technical Information
Required Interpreter Version: | Available in version 2.411 and above. |
Byte-Code Value: | 167 (0xA7 hex) |