Difference between revisions of "Div (Float function)"

From m204wiki
Jump to navigation Jump to search
m
m
 
(34 intermediate revisions by 5 users not shown)
Line 1: Line 1:
This [[Intrinsic Classes|intrinsic]] function returns the integer part of the result of dividing
+
{{Template:Float:Div subtitle}}
the method object by the method argument.
 
  
The numbers to be divided are first rounded to the nearest integer, including zero.
+
The <var>Div</var> [[Intrinsic classes|intrinsic]] function returns the integer part of the result of dividing the method object by the method argument.
Any remainder from the division is ignored.
 
  
The [[Intrinsic Modulus Function|Modulus function]] returns the remainder of a division.
+
The numbers to be divided are first rounded to the nearest integer, including zero.  Any remainder from the division is ignored.
  
The Div function is available as of version 7.3 of the [[Sirius Mods]].
+
==Syntax==
===Div syntax===
+
{{Template:Float:Div syntax}}
  %quo = number:Div(num)
 
====Syntax terms====
 
<dl>
 
<dt>%quo
 
<dd>A variable to receive the integer part of the quotient.
 
<dt>number
 
<dd>A Float value to be divided by the method argument, ''num''.
 
<dt>num
 
<dd>A non-zero numeric value. A value of 0, or a value that rounds down to 0,
 
causes a request cancellation.
 
</dl>
 
===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===
+
===Syntax terms===
[[List of Intrinsic Float Methods]]
+
<table class="syntaxTable">
 +
<tr><th>%number</th>
 +
<td>A variable to receive the integer part of the quotient. </td></tr>
  
[[Category:Intrinsic Float methods]]
+
<tr><th>float</th>
[[Category:Intrinsic methods]]
+
<td>A <var>Float</var> value to be divided by the method argument, <var class="term">divisor</var>. </td></tr>
[[Category:System methods]]
+
 
 +
<tr><th>divisor</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>
 +
</table>
 +
 
 +
==Usage notes==
 +
<ul>
 +
<li><var>Div</var> is available as of <var class="product">Sirius Mods</var> Version 7.3.
 +
</ul>
 +
 
 +
==Examples==
 +
<ol>
 +
<li>The following statement sets <code>%z</code> to the integer quotient from the division of the number in <code>%x</code> (rounded) by the number in <code>%y</code> (rounded):
 +
<p class="code">%z = %x:div(%y)
 +
</p>
 +
<li>The following statement sets <code>%z</code> to <code>-95</code>:
 +
<p class="code">%z = -191.4:div(2.3)
 +
</p></ol>
 +
 
 +
==See also==
 +
The <var>[[Modulus_(Float_function)|Modulus]]</var> function returns the remainder of a division.
 +
 
 +
{{Template:Float:Div footer}}

Latest revision as of 17:36, 2 November 2012

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

%number A variable to receive the integer part of the quotient.
float A Float value to be divided by the method argument, divisor.
divisor 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

  1. The following statement sets %z to the integer quotient from the division of the number in %x (rounded) by the number in %y (rounded):

    %z = %x:div(%y)

  2. The following statement sets %z to -95:

    %z = -191.4:div(2.3)

See also

The Modulus function returns the remainder of a division.