mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-07-22 20:45:13 +00:00
6912727753
Help file snapshot as of 07/31/2022.
45 lines
1.2 KiB
Plaintext
45 lines
1.2 KiB
Plaintext
{{QBDLDATE:07-31-2022}}
|
|
{{QBDLTIME:23:54:09}}
|
|
The [[\]] mathematical operator performs [[INTEGER]] division on a numerical value.
|
|
|
|
|
|
{{PageSyntax}}
|
|
: {{Parameter|return_value}} = {{Parameter|number}} [[\]] {{Parameter|divisor}}
|
|
|
|
|
|
{{PageDescription}}
|
|
* Number value can be any literal or variable numerical type.
|
|
* '''Divisor (second value) must not be a value of 0 to .5'''. This will create a [[ERROR Codes|"Division by zero" error!]] due to [[CINT]] rounding.
|
|
* Return values will be [[INTEGER]] or [[LONG]] value types only.
|
|
* Rounding is done to the closest EVEN [[INTEGER|integer]] or [[LONG|long integer]] value.
|
|
* Use the [[/|/ normal division]] operator for [[SINGLE]] or [[DOUBLE]] floating decimal point return values.
|
|
* Division and multiplication operations are performed before addition and subtraction in QBasic's order of operations.
|
|
|
|
|
|
{{PageExamples}}
|
|
;Example:Displays how floating decimal point values are rounded to the closest even [[INTEGER|integer]] value.
|
|
{{CodeStart}}
|
|
{{Cl|PRINT}} 0.5 \ 1
|
|
{{Cl|PRINT}} 1.5 \ 1
|
|
{{Cl|PRINT}} 2.5 \ 1
|
|
{{Cl|PRINT}} 3.5 \ 1
|
|
{{Cl|PRINT}} 4.5 \ 1
|
|
{{Cl|PRINT}} 5.5 \ 1
|
|
{{CodeEnd}}
|
|
{{OutputStart}}0
|
|
2
|
|
2
|
|
4
|
|
4
|
|
6
|
|
{{OutputEnd}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[Mathematical Operations]]
|
|
|
|
|
|
{{PageNavigation}}
|
|
|
|
[[Category:Final]]
|