Public Function Roundf (Number, Optional Numofdigits as long) AS DOUBLE
IF not isnumeric (Number) THEN EXIT FUNCTION
DIM IPOS As Long
IPOS = INSTR (Number, ".")
Dim dbdesimalpart as long
DIM DBROUNDPART AS Long
IF ipos> 0 THEN
DBDesimalPart = MID (Number, IPOS 1)
END IF
IF Numofdigits
DBROUNDPART = MID (DBDesimalpart, Numofdigits 1, 1)
END IF
IF dBroundpart> 4 THEN
DBDesimalpart = Left (dbdesimalpart, numofdigits) 1
Else
DBDesiMalpart = Left (dbdesimalpart, numofdigits)
END IF
Roundf = Val (int (Number) & "." & Dbdesimalpart)
END FUNCTION