Announcement

Collapse

Maintenance

The forum could be offline for 30-60 minutes in the very near future for maintenance (said 3pm Pacific). I was behind on getting this notice. I do apologize.
See more
See less

convert string to number

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • convert string to number

    hi for all

    i have problem that when im using VAL command
    to convert any string numbers
    if the string > 35000
    it will give wrong data

    exp.

    a$ = "40000"
    i% = VAL(a$)

    i will not have i% = 40000

    is there any other function could convert the string to a number

    thanks for all


    ------------------
    Nidal
    Nidal

  • #2
    The problem is that i% is an integer. Integers can only hold up
    to the number 32,767 (I do not recall what the lowest number
    they'll hold is). To hold numbers larger than that, use a
    bigger variable type, such as a LONG or a QUAD.


    ------------------
    mailto:[email protected][email protected]</A>

    [This message has been edited by Clay Clear (edited January 25, 2003).]

    Comment


    • #3
      Nidal,
      i% is a 16 bit integer, it can only hold a value upto 32768.

      Try using i&=val(a$): print i&

      i& is a 32 bit integer which will hold numbers of 40000 and above.

      Paul.


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

      Comment


      • #4
        thanks for your help
        it is working fine now

        thanks


        ------------------
        Nidal
        Nidal

        Comment


        • #5
          i% is a 16 bit integer, it can only hold a value upto 32768.
          The range of an INTEGER class variable is -32,768 to +32,767.

          ------------------
          If you try to make something idiot-proof, someone will invent a better idiot.
          If you try to make something idiot-proof, someone will invent a better idiot.

          Comment

          Working...
          X