03-21-2006, 08:07 AM
Quote:Dr_Davenstein Wrote:Why couldn't you just do this?
Code:Function Round( n As Single ) As Integer
Round = n\1
End Function
I've never tried your approach using integer division. The manual says that the variable is first "rounded" to an integer or long before the divide. That's great, but which of the 8 Microsoft defined rounding methods does it perform?
Give me a chance to test it on my DOS machine, and I'll get back to you.
*****
I did some testing. The n\1 yields mostly good rounding EXCEPT when the the number n is even and has a .5 decimal value. This rounding method is called Banker's Rounding. The one which we all use and which we are implementing here is Symmetric Arithmetic Rounding.
Example: 124.5 rounded should give 125. The n\1 approach gives 124.
Nice try!
*****