Jump to content

LV 7.1 Convert a Decimal String "1234567899" to an Integer equivalent


jaehov

Recommended Posts

Hey techies

I am working with a pre-existing test tool with LV 7.1

I need to convert a Decimal String "1234567899" to an Integer equivalent (no truncation or other formatting)

Essentially I want the string "1234567899" to be converted to the Integer (1234567899)

I know in LV 8 this would be a breeze with U64. But how can I perform get same result in LV 7.1 ?

thanks

The new guy on the block

Link to comment

QUOTE (jaehov @ Feb 14 2009, 11:02 AM)

Essentially I want the string "1234567899" to be converted to the Integer (1234567899)

I know in LV 8 this would be a breeze with U64. But how can I perform get same result in LV 7.1 ?

Umm, that number fits fine in an I32. Assuming you are really having a problem, why not use DBLs? Just because it's not limited to integers doesn't mean its a bad choice for them if U32 is too small.

Link to comment

QUOTE (jdunham @ Feb 15 2009, 01:22 AM)

Umm, that number fits fine in an I32. Assuming you are really having a problem, why not use DBLs? Just because it's not limited to integers doesn't mean its a bad choice for them if U32 is too small.

i actually got the number wrong, its longer than that. Try "12345678991234567899"

Link to comment

Without using a different data type such as a double then your only real option is to handle 64 bit integers yourself. You would have to do this by using two 32 bit integers and creating your own methods for operating on those values. this would be a non-trivial exercise but if you must have them in integer format this is one of your only real alternatives. Much more memory intensive but possibly easier to work with and more extensible would be to store each digit of the number as an element of a byte array. Again, you have to create your own methods for operating on the numbers but they would be fairly straight forward to implement. Think back to your early days of learning math.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.