单从这两个函数来看.是不可以的.
如果一定要自己写..
这样试试..
Function Round(X As Double, DP As Integer) As Double
X = X * 10 ^ DP + 0.5
Round = Int(X) / 10 ^ DP
End Function
或
Public Function Round(ByVal dblNumber As Double, Optional ByVal intFactor As Integer = 0) As Double
Round = Fix(cdbl(dblNumber * 10 ^ intFactor + 0.5 * Sgn(dblNumber))) / 10 ^ intFactor
End Function
如果一定要自己写..
这样试试..
Function Round(X As Double, DP As Integer) As Double
X = X * 10 ^ DP + 0.5
Round = Int(X) / 10 ^ DP
End Function
或
Public Function Round(ByVal dblNumber As Double, Optional ByVal intFactor As Integer = 0) As Double
Round = Fix(cdbl(dblNumber * 10 ^ intFactor + 0.5 * Sgn(dblNumber))) / 10 ^ intFactor
End Function
我的msn: myfend@