Div (Float function): Difference between revisions
Jump to navigation
Jump to search
m (1 revision) |
m (match syntax diagram to revised template; fix tags and links) |
||
Line 1: | Line 1: | ||
{{Template:Float:Div subtitle}} | {{Template:Float:Div subtitle}} | ||
The <var>Div</var> <var>[[Intrinsic classes|intrinsic]]</var> function returns the integer part of the result of dividing the method object by the method argument. | |||
the method object by the method argument. | |||
The numbers to be divided are first rounded to the nearest integer, including zero. | The numbers to be divided are first rounded to the nearest integer, including zero. Any remainder from the division is ignored. | ||
Any remainder from the division is ignored. | |||
==Syntax== | ==Syntax== | ||
{{Template:Float:Div syntax}} | {{Template:Float:Div syntax}} | ||
===Syntax terms=== | ===Syntax terms=== | ||
<table class="syntaxTable"> | <table class="syntaxTable"> | ||
<tr><th>% | <tr><th>%integerQuotient</th> | ||
<td>A variable to receive the integer part of the quotient. </td></tr> | <td>A variable to receive the integer part of the quotient. </td></tr> | ||
<tr><th>float</th> | |||
<td>A <var>Float</var> value to be divided by the method argument, ''num''. </td></tr> | |||
<tr><th>number</th> | <tr><th>number</th> | ||
<td>A non-zero numeric value. A value of 0, or a value that rounds down to 0, causes a request cancellation.</td></tr> | <td>A non-zero numeric value. A value of 0, or a value that rounds down to 0, causes a request cancellation.</td></tr> | ||
</table> | </table> | ||
==Usage notes== | |||
<ul><li><var>Div</var> is available as of <var class="product">[[Sirius Mods]]</var> Version 7.3.</ul> | |||
==Examples== | ==Examples== | ||
The following statement returns to %z the integer quotient from the division of | <ol><li>The following statement returns to %z the integer quotient from the division of the number in %x (rounded) by the number in %y (rounded): | ||
the number in %x (rounded) by the number in %y (rounded): | |||
<p class="code">%z = %x:div(%y) | <p class="code">%z = %x:div(%y) | ||
</p> | </p> | ||
The following statement returns ''''-95'''' to %z: | <li>The following statement returns ''''-95'''' to %z: | ||
<p class="code">%z = -191.4:div(2.3) | <p class="code">%z = -191.4:div(2.3) | ||
</p></ol> | |||
==See also== | ==See also== | ||
The <var>[[Modulus_(Float_function)|Modulus function]]</var> returns the remainder of a division. | |||
{{Template:Float:Div footer}} | {{Template:Float:Div footer}} |
Revision as of 06:48, 3 February 2011
Integer division (Float class)
The Div intrinsic function returns the integer part of the result of dividing the method object by the method argument.
The numbers to be divided are first rounded to the nearest integer, including zero. Any remainder from the division is ignored.
Syntax
%number = float:Div( divisor)
Syntax terms
%integerQuotient | A variable to receive the integer part of the quotient. |
---|---|
float | A Float value to be divided by the method argument, num. |
number | A non-zero numeric value. A value of 0, or a value that rounds down to 0, causes a request cancellation. |
Usage notes
- Div is available as of Sirius Mods Version 7.3.
Examples
- The following statement returns to %z the integer quotient from the division of the number in %x (rounded) by the number in %y (rounded):
%z = %x:div(%y)
- The following statement returns '-95' to %z:
%z = -191.4:div(2.3)
See also
The Modulus function returns the remainder of a division.