Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Round number to certain number of digits 1

Status
Not open for further replies.

abeschneider

Mechanical
Sep 25, 2003
189
Is it possible to round numbers to a specific number of digits?

ie round(19.0475, 2) = 19.05

Can't seem to figure out how to accomplish anything but:
round(19.0475) = 19

Thanks!
 
Replies continue below

Recommended for you

In what context? Are we talking about when making a drawing or when creating expressions?


John R. Baker, P.E.
Product "Evangelist"
NX Product Line
UGS Corp
Cypress, CA
 
Given the following:

X = the original number you wish to round

XR = the result after rounding

places = represents the number of places that you wish to round to, using the following scheme:

1 decimal place = 10
2 decimal places = 100
3 decimal places = 1000
etc.

Also make sure that the places expression has a dimensionality of "Constant".

This then gives you a final expression of:

XR = round(X*places)/places

Of course you could replace the variable "places" in the above expression with the 10's, 100's, 1000's, etc. as needed.


John R. Baker, P.E.
Product "Evangelist"
NX Product Line
UGS Corp
Cypress, CA
 
John,
Once again, you give perfectly clear (and functional) direction!
Thanks a lot,
Abe
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor