2016-03-18 11:36:04 +00:00
|
|
|
{{DISPLAYTITLE:_ROUND}}
|
2017-10-10 14:55:21 +00:00
|
|
|
The [[_ROUND]] function rounds to the closest even [[INTEGER]], [[LONG]] or [[_INTEGER64]] numerical value.
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{PageSyntax}}
|
2017-10-10 14:55:21 +00:00
|
|
|
: {{Parameter|value}} = [[_ROUND]]({{Parameter|number}})
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{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]].
|
2017-10-10 14:55:21 +00:00
|
|
|
* Rounding is done to the closest even [[INTEGER|integer]] value. The same as QBasic does with [[\|integer division]].
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
''Example:'' Displays how QB64 rounds to the closest even integer value.
|
|
|
|
{{CodeStart}}
|
|
|
|
{{Cl|PRINT}} {{Cl|_ROUND}}(0.5)
|
|
|
|
{{Cl|PRINT}} {{Cl|_ROUND}}(1.5)
|
|
|
|
{{Cl|PRINT}} {{Cl|_ROUND}}(2.5)
|
|
|
|
{{Cl|PRINT}} {{Cl|_ROUND}}(3.5)
|
|
|
|
{{Cl|PRINT}} {{Cl|_ROUND}}(4.5)
|
|
|
|
{{Cl|PRINT}} {{Cl|_ROUND}}(5.5) '' ''
|
|
|
|
{{CodeEnd}}
|
|
|
|
{{OutputStart}}0
|
|
|
|
2
|
|
|
|
2
|
|
|
|
4
|
|
|
|
4
|
|
|
|
6
|
|
|
|
{{OutputEnd}}
|
|
|
|
|
|
|
|
|
|
|
|
''See also:''
|
|
|
|
* [[INT]], [[CINT]]
|
|
|
|
* [[FIX]], [[CLNG]]
|
|
|
|
|
|
|
|
|
2019-04-15 01:15:33 +00:00
|
|
|
{{PageNavigation}}
|