【发布时间】:2010-07-08 19:59:37
【问题描述】:
我很难解释这一点。以下函数用作工作表公式。 “空”值仅表示单元格为空,因此没有任何值。给定值 {empty, empty, 0.8, 0.2},以下函数有时会返回像 5.55111512312578E-17 这样的值。在调试器中,看起来一切都是正确的,直到 ParamArray 中的最后一个值(在本例中为 0.2)被处理。有什么想法吗?
Private Function getOvertimeEP(ParamArray epAllocations() As Variant)
Dim overtimeEP As Double
overtimeEP = -1
For Each nextVal In epAllocations
overtimeEP = overtimeEP + nextVal
Next
If overtimeEP < 0 Then
overtimeEP = 0
End If
getOvertimeEP = overtimeEP
End Function
【问题讨论】: