[RESOLVED] error 6 overflow
i'm getting the overflow error for the caltest variable and also for the calc variable, the function, for these numbers, in order 1 through 5
27340, 25660, 30490, 28690, 25550, that are passed to the function
Code:
Function calc(date1Reach As Integer, date2Reach As Integer, date3Reach As Integer, date4Reach As Integer, date5Reach As Integer) As Double
Dim calctest As Double
On Error GoTo err_trap
calctest = (date1Reach + date2Reach + date3Reach + date4Reach) / 4
calc = (((date1Reach + date2Reach + date3Reach + date4Reach) / 4) _
- ((date2Reach + date3Reach + date4Reach + date5Reach) / 4)) _
/ ((date2Reach + date3Reach + date4Reach + date5Reach) / 4)
i dont see how (27340+25660+30490+ 28690)/4 could cause an overflow for a double? and as well for numbers in this range how it could throw an overflow for the longer calculation for the value of the function, calc?