CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz] ARKANCE | CONTACT - CZ | SK | EN | DE
Over 1.092.000 registered users (EN+CZ). AutoCAD tips, Inventor tips, Revit tips. Try the new precise Engineering calculator. New AutoCAD 2026 commands and variables.
RSS channel - CAD tips RSS tips
RSS discussions

Discussion Discussion forum

?
CAD discussions, advices, exchange of experience

CAD Forum - Homepage CAD discussion forum - ask any CAD-related questions here, share your CAD knowledge on AutoCAD, Inventor, Revit and other Autodesk software with your peers from all over the world. To start a new topic, choose an appropriate forum.

Please abide by the rules of this forum.
This is a peer-to-peer forum. The forum doesn't replace the official direct technical support provided by ARKANCE for its customers.
How to post questions: register or login, go to the specific forum and click the NEW TOPIC button.
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closedlimitations to a real

 Post Reply Post Reply
Author
XPeter61 View Drop Down
Newbie
Newbie


Joined: 09.Jun.2009
Status: Offline
Points: 2
Direct Link To This Post Topic: limitations to a real
    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
Back to Top
HAWDesigner View Drop Down
Senior Member
Senior Member


Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
Direct Link To This Post 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
Back to Top
CarlB View Drop Down
Senior Member
Senior Member


Joined: 16.Oct.2009
Location: United States
Status: Offline
Points: 321
Direct Link To This Post 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"
 
Back to Top
HAWDesigner View Drop Down
Senior Member
Senior Member


Joined: 04.Aug.2008
Location: United States
Using: AutoCAD R14, AutoCAD 2009, AutoCAD 2010
Status: Offline
Points: 310
Direct Link To This Post 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
Back to Top
XPeter61 View Drop Down
Newbie
Newbie


Joined: 09.Jun.2009
Status: Offline
Points: 2
Direct Link To This Post Posted: 14.Dec.2010 at 08:28
CarlB,
 
thanks for your answer.
I think this is exactly the information I was looking for.
 
Peter
 
Back to Top

Related CAD tips:


 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down



This page was generated in 0,098 seconds.