SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Sep 2002
    Location
    Sarasota, FL
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Converting strings to large values.

    I need some advice on converting large numbers as strings to their appropriate values. These values are in excess of 2147483647, making the Val() method unusable as it seemingly only converts strings to integers or reals. Any ideas? Thanks.

    ------------------

  2. #2
    Senior Member
    Join Date
    Aug 1999
    Location
    Cambridge, UK
    Posts
    470
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Converting strings to large values.

    I'm not clear on the details here, but presumably silktest tries to cast that value to an INT, and gets a numeric overflow - leaving you with some negative number or something.
    Have you tried appending ".1" to the end of the string, using Val() which would hopefully then realise it has to cast to a REAL, and then subtracting 0.1 from the result? It's a bit of a hack, but it should work.

    ------------------

  3. #3
    Senior Member
    Join Date
    Feb 2000
    Posts
    1,497
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Converting strings to large values.

    Vince is on the right track. All you really have to do is concatenate a "." to the string representing the large number and pass it to Val() like this.

    REAL r = Val(sBigNumber + ".")


    John


    ------------------

  4. #4
    Junior Member
    Join Date
    Sep 2002
    Location
    Sarasota, FL
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Converting strings to large values.

    Wow, that was an unbelievably easy fix. Thanks for your prompt and helpful replies.

    -md

    ------------------

  5. #5
    Member
    Join Date
    Sep 2002
    Location
    Chicago, Illinois, USA
    Posts
    90
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Converting strings to large values.

    REAL r = Val(sBigNumber + ".")

    This is a real smart one.

    I wonder why I used + ".0".

    ------------------

 

 

Posting Permissions

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

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:54 PM.

Copyright BetaSoft Inc.