-
Hello!!!
I am making math operations that give a very big results. Inside intarations I have, for example
dim value_f as double
.
.
.
.
.
value_f=value_f + x*16*exp(i)
.
.
.
.
.
value_f is defined as Double, and its max value that can have a double variable is 1.7976913486232E308. When the operations results a big value, then occurs a overflow error.
Are there any way by use or declarate a bigger variable o continue making iterations without lost the program flow and will have the final result
Thanks
Juan Carlos
[email protected]
-
You can use Currency data type instead of Double. Currency holds 8 bytes of data instead of 4 bytes.
-
Um, isn't a Double data-type 8 bytes, example:
Code:
Dim dblTemp As Double
Call MsgBox(LenB(dblTemp))
>> Displays "8"
I'm I wrong here?
-
SonGouki is right. Both Double and Currency are 8 bytes and currency goes down up to 922,337,203,685,477.5807 and double
goes up to 1.79769313486232E308 for positive values. So double is bigger.
Sorry JCHACON,
-
DECIMAL is the best!
a = CDec(1E-28)
MsgBox a
a = CDec(1E+28)
MsgBox a
VB5 help says:
Decimal variables are stored as 96-bit (12-byte) unsigned integers scaled by a variable power of 10. The power of 10 scaling factor specifies the number of digits to the right of the decimal point, and ranges from 0 to 28. With a scale of 0 (no decimal places), the largest possible value is +/-79,228,162,514,264,337,593,543,950,335. With a 28 decimal places, the largest value is +/-7.9228162514264337593543950335 and the smallest, non-zero value is +/-0.0000000000000000000000000001.
-
Oops, don't I feel dumb. I was writing about Double, but was actually thinking aboud Long. Sorry about that....just a tough day.