gpd Posted July 25, 2010 Share Posted July 25, 2010 I have a lisp routine which reads point coordinates from excel sheet and inserts blocks at those points. All the points have 3 decimal places. For example 614332.785, 2619494.544 The routine works fine. Now in another routine I get the base points of the blocks and compare them to their coordinates in the excel file they are not same but have slight difference for example the base point of the block inserted at above point would be reported by lisp as (614333.0, 261949e+006). What is the reason for this difference. How can I get the same exact value. Similarly suppose their is a value 6123.494 stored in an excel cell when I extract that value (using vlisp) the system shows value of variant to be 6123.494 but when I call (valx-variant-value) the returned value becomes 6123 Why this .494 part is omitted. Please guide. Thanks Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 25, 2010 Share Posted July 25, 2010 Simply change the last number in the function as the following. (rtos [color="blue"]YourNumber[/color] 2 [color="red"]3[/color] ) It is better also to paste your codes to let us check them for you if any other mistakes found... Regards Tharwat Quote Link to comment Share on other sites More sharing options...
gpd Posted July 25, 2010 Author Share Posted July 25, 2010 Thanks Tharwat, But I want the end resut as a real number and not string. rtos perhaps converts result to String. Any Suggestions? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 25, 2010 Share Posted July 25, 2010 Here it goes; (setq a 15.12345) 15.1235 (setq b (rtos a 2 3)) "15.123" (setq c ([color="red"]atof[/color] b)) 15.123 Regards Tharwat Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 25, 2010 Share Posted July 25, 2010 Read up on EQUAL in the developer's guide. Quote Link to comment Share on other sites More sharing options...
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.