Results 1 to 6 of 6

Thread: Values bigger than double Variable

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 1999
    Location
    Caracas, D.F., Venezuela
    Posts
    4
    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]

  2. #2
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    You can use Currency data type instead of Double. Currency holds 8 bytes of data instead of 4 bytes.

  3. #3
    Addicted Member
    Join Date
    Aug 1999
    Location
    Ottawa,ON,Canada
    Posts
    217
    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?

  4. #4
    Addicted Member
    Join Date
    Oct 1999
    Location
    Oporto, Portugal
    Posts
    134
    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,
    Jorge Ledo
    [email protected]
    Portugal were the sun allways shine... for programmers.

  5. #5
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  6. #6
    Serge's Avatar
    Join Date
    Feb 1999
    Location
    Scottsdale, Arizona, USA
    Posts
    2,744
    Oops, don't I feel dumb. I was writing about Double, but was actually thinking aboud Long. Sorry about that....just a tough day.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width