Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rounding...

Status
Not open for further replies.

Nate242

Mechanical
Joined
Feb 14, 2005
Messages
25
Location
US
What is the best way to round using autolisp? I'd like to be able to round to 3 places.

ex) 200.4955 -> 200.496
 
Are you trying to change a real to string? If so then you do something similar to this:
(rtos 200.4955 2 3) which is
(rtos number mode accuracy) mode is optional if your units are set to the desired output (i.e. scientific, decimal, engineering etc.)
 
Adding to lpseifert's post..

If you wante a real number as a result, use 'atof' on the rounded string returned by 'rtos'.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top