CitectVBA Programming Reference > Understanding CitectVBA Language Basics > Numbers > Arithmetic rounding

Arithmetic rounding

When continually rounding in one direction (down or up), the resulting number is not necessarily the closest to the original number. For example, if you round 1.9 down to 1, the difference is a lot larger than if you round it up to 2. It is easy to see that numbers from 1.6 to 2.4 should be rounded to 2. However, what about 1.5, which is equidistant between 1 and 2? By mathematical convention, the half-way number is rounded up.

To implement rounding half-way numbers in a symmetric fashion, -.5 is rounded down to -1, or in an asymmetric fashion, where -.5 is rounded up to 0.

CitectVBA does not have a function for arithmetic rounding.