Jump to content

Recommended Posts

Posted

Not sure what is happening here, but when I convert a string into an integer, the number is completely different

 

(setq p+ (strcat p0 p1 p3 p4 p6 p7 p9 p10))
(setq peq (atoi p+))

 

Maybe it has to do with the length of the number? I don't know

 

The variable p+ = "4848495169565868"

and the result of using atoi makes the vaeiable peq = 2147483647

 

Ant ideas?

Posted
Not sure what is happening here, but when I convert a string into an integer, the number is completely different

 

(setq p+ (strcat p0 p1 p3 p4 p6 p7 p9 p10))
(setq peq (atoi p+))

 

Maybe it has to do with the length of the number? I don't know

 

The variable p+ = "4848495169565868"

and the result of using atoi makes the vaeiable peq = 2147483647

 

Ant ideas?

 

Hope this Helps

Posted

Numbers are stored either as a whole number (integer) or decimal number (known as floating point or real numbers). Generally in programming languages integers can only contain smaller values compared to floating point. This is to help with memory management (smaller numbers require less memory to store) and to improve the speed of the program. Lisp is no exception and an integer can only contain a value between -2,147,483,648 and +2,147,483,647. If your number lies outside of this range then you will have to use a floating point number.

 

Have a look at the atof and float functions.

Posted

well thats pretty crap lol. I have altered my code to not need to worry about going over the limit. Thanks for the info.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

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.   Restore formatting

  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...