|
求助:为何四舍五入函数不起作用?
使用以下代码:
Public Function RoundToLarger(dblInput As Double, intDecimals As Integer) As Double
'Implements a variant of the Round() function, that rounds-to-larger
'rather than rounds-to-even:
Dim strFormatString As String 'Format string
'If input is zero, just return zero. Else format as appropriate:
If dblInput <> 0 Then
strFormatString = "#." & String(intDecimals, "#")
RoundToLarger = Format(dblInput, strFormatString)
Else
RoundToLarger = 0
End If
End Function
却不能将56.54X5430四舍五入,得数为307012.22,而不是307012.20?
请各位帮忙解决,谢谢! |
|