ROUND: Difference between revisions
Jump to navigation
Jump to search
Navigation:
Main Page with Articles and Tutorials
Keyword Reference - Alphabetical
Keyword Reference - By usage
Report a broken link
(Created page with "{{DISPLAYTITLE:_ROUND}} The _ROUND function rounds to the closest even INTEGER, LONG or _INTEGER64 numerical value. {{PageSyntax}} : {{Parameter|value}} = _ROUND({{Parameter|number}}) {{PageDescription}} * Can round SINGLE, DOUBLE or _FLOAT floating decimal point parameter values. * Can be used when numerical values exceed the limits of CINT or CLNG. * Rounding is done to the closest even integer value. The same as...") |
No edit summary |
||
Line 20: | Line 20: | ||
{{Cl|PRINT}} {{Cl|_ROUND}}(3.5) | {{Cl|PRINT}} {{Cl|_ROUND}}(3.5) | ||
{{Cl|PRINT}} {{Cl|_ROUND}}(4.5) | {{Cl|PRINT}} {{Cl|_ROUND}}(4.5) | ||
{{Cl|PRINT}} {{Cl|_ROUND}}(5.5) | {{Cl|PRINT}} {{Cl|_ROUND}}(5.5) | ||
{{CodeEnd}} | {{CodeEnd}} | ||
{{OutputStart}}0 | {{OutputStart}}0 | ||
Line 37: | Line 37: | ||
{{PageNavigation}} | {{PageNavigation}} | ||
[[Category:Latest]] |
Revision as of 21:00, 2 July 2022
The _ROUND function rounds to the closest even INTEGER, LONG or _INTEGER64 numerical value.
Syntax
- value = _ROUND(number)
Description
- Can round SINGLE, DOUBLE or _FLOAT floating decimal point parameter values.
- Can be used when numerical values exceed the limits of CINT or CLNG.
- Rounding is done to the closest even integer value. The same as QBasic does with integer division.
Example: Displays how QB64 rounds to the closest even integer value.
PRINT _ROUND(0.5) PRINT _ROUND(1.5) PRINT _ROUND(2.5) PRINT _ROUND(3.5) PRINT _ROUND(4.5) PRINT _ROUND(5.5) |
0 2 2 4 4 6 |
See also: