Overflow puzzle
When both operands are long, the return data type of the * operator is
Long. Both your operands fit within the Max Long, but the result of the
multiplication doesn't, hence the overflow.
The ^ operator returns a double, which will coerce the result to a
double, and the return data type of the * operator will be a Double.
You could make the first work by making one or the other operand a
double, e.g.,
300#*8520000
or
300*8520000#
In article ,
"David Myle" wrote:
Hi all,
My VBA editor returns a Run time overflow error for 300*8520000
but calculates without any fuss
2556*10^6
Yet both figures are the same viz: 2556000000
The same editor has no problem evaluating 2556*10^300
What gives?
|