1
1
Fork 0
mirror of https://github.com/DualBrain/QB64.git synced 2023-11-19 13:10:13 +00:00
QB64-website/wiki/_ROUND.md
2022-12-24 21:14:48 -06:00

789 B

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 []().

Example(s)

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