Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Rounding...

Status
Not open for further replies.

Nate242

Mechanical
Feb 14, 2005
25
0
0
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
 
Replies continue below

Recommended for you

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.
Back
Top