problem with vb's round function
Posted on 2002-04-30
Hello experts !
Recently i detected a bug in the round function. In the immediate window of the vb-ide i get the following response:
The return value should be 96.65 by definition. Format works properly:
Can i get a fix (i have vb6 SP5)or is there an other elegant function. I don't like using format numbers which aren't been displayed or printed.
Also i know that i can use a function like this for example:
Public Function RoundIt(Number As Variant, NumDigitsAfterDecimal As Long) As Variant
If Not IsNumeric(Number) Then
RoundIt = Number
RoundIt = Int(0.5 + Number * (10 ^ NumDigitsAfterDecimal)) / (10 ^ NumDigitsAfterDecimal)
... but this is perhaps a slow and inelegant way like format. Any suggestions ?