Andrew1979 Posted December 3, 2014 Posted December 3, 2014 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? Quote
hanhphuc Posted December 3, 2014 Posted December 3, 2014 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 Quote
JamCAD Posted December 3, 2014 Posted December 3, 2014 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. Quote
Andrew1979 Posted December 3, 2014 Author Posted December 3, 2014 well thats pretty crap lol. I have altered my code to not need to worry about going over the limit. Thanks for the info. Quote
Recommended Posts
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.