# Difference between revisions of "Div (Float function)"

Jump to navigation
Jump to search

m (re-match syntx to resided template) |
m |
||

Line 21: | Line 21: | ||

==Examples== | ==Examples== | ||

− | <ol><li>The following statement | + | <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 class="code">%z = %x:div(%y) | ||

</p> | </p> | ||

− | <li>The following statement | + | <li>The following statement sets <code>%z</code> to <code>-95</code>: |

<p class="code">%z = -191.4:div(2.3) | <p class="code">%z = -191.4:div(2.3) | ||

</p></ol> | </p></ol> |

## Revision as of 19:14, 8 February 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

- 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)

- The following statement sets
`%z`

to`-95`

:%z = -191.4:div(2.3)

## See also

The `Modulus function` returns the remainder of a division.