Print Page | Close Window

limitations to a real

Printed From: CAD Forum
Category: EN
Forum Name: AutoCAD
Forum Description: Discussion about AutoCAD and AutoCAD LT, viewers, DWG and DWF formats, Design Review, AutoCAD 360, add-ons
URL: https://www.cadforum.cz/forum_en/forum_posts.asp?TID=4905
Printed Date: 17.Apr.2026 at 16:53


Topic: limitations to a real
Posted By: XPeter61
Subject: limitations to a real
Date Posted: 04.Dec.2010 at 17:43

Peter Poeliejoe 04-12-10  17:21
When I type this (AutoLISP):

(+ 10000.8 2.4), the result is 10003.2, as expected.

However, when typed: (+ 100000.8 2.4), the result is
100003.0. Is 100000 a magical border voor a real in AutoLISP? Any settings involved here?

Thanks in advance for any brain activity...
Peter



Replies:
Posted By: HAWDesigner
Date Posted: 13.Dec.2010 at 22:45
All I can say is the system isn't perfect. LISP is a very old language and relied upon many many different factors that probably aren't in place with any of today's technology.

Good Luck!!


-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: CarlB
Date Posted: 13.Dec.2010 at 23:15
Lisp is limited by the same precision as is AutoCAD. It can store 16 digits in a number. To properly display numbers as internally calculated, use the "rtos" function.
 
For your example, you'll see the accurate decimals by setting precision to 1 or higher:
(rtos (+ 100000.0 3.2) 2 1)
 
where the "2" specifies decimal output, "1" is the precision, which can be 0 to 16.
 
With large numbers, the number of decimal places may be less that the precision; such as:
Command: (rtos 1234567890.0987654321 2 16)
"1234567890.098765"
 


Posted By: HAWDesigner
Date Posted: 13.Dec.2010 at 23:27
Nice!! Thanks Carl. I guess I learned my 'something new' today.

I have a limited knowledge of LISP, but I do have a background in computer programming and love getting tidbits of info like this.


-------------
--
R. Williams
AutoCAD 2010 Certified Professional
<!-- If all else fails hit F1 -->
<<AutoCAD 2009


Posted By: XPeter61
Date Posted: 14.Dec.2010 at 08:28
CarlB,
 
thanks for your answer.
I think this is exactly the information I was looking for.
 
Peter
 



Print Page | Close Window