Rounding dilemma

As with everyone else, I assume they have rolled their own rounding function. Here is the one we have been using up until now, but we have a new one now that seems to work.

Two parameters passed, the number and the number of decimals.

‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’‘’’
Dim RoundedAmt,ABSNumber As Double
RoundedAmt = 0

’ MODIFIED BY KM 12/30/13 SO THAT NEGATIVE NUMBERS ROUND LIKE VFP DID
ABSNumber = ABS(Number)

If Decimals = 0 Then
RoundedAmt = Round(ABSNumber)
Else
RoundedAmt = Round(ABSNumber * (10 ^ Decimals)) / (10 ^ Decimals)
End

If Number < 0 Then
RoundedAmt = RoundedAmt * -1
End

Return RoundedAmt

2 Likes