I don't know the overflow error very well, so I'm pretty at a loss here.
Writing in VBA I'm calling a VBA function, which is a wrapper of a C++ function from a dll (which I have no access to the innards of). The VBA/C++ function returns a double. It is a derivative valuation using numerical methods.
For a time yesterday (but it may have gone away now) I was getting the overflow error when trying assign the function return to a variable declared as double. But on the error halt, I could see the correct value assigned to the double, in the locals window (8.17...). And when I instead assign the function return to a variant, I get the same value with no error, the variant being type Variant/Double.
Any idea what could be going on here? I'm completely lost. Thanks in advance for any ideas. R
Edit: One more thing I tried was applying CDbl to the function return when assigning it to the variant. Here's some pseudo code, just to clarify my cases:
Dim db as Double, va as Variant
db = DerivativeValue(a, b, c...)
This gives the overflow, but db has the correct value in the locals window, on the error.
va = DerivativeValue(a, b, c...)
No error, same value. va is type Variant/Double
va = CDbl(DerivativeValue(a, b, c...))
Now overflow again. I forgot what va did in the Locals window in this case, but likely it's the same as case 1.