Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Relation for rounding to nearest integer

Status
Not open for further replies.

Korichnevijgigant

Aerospace
Oct 7, 2009
133
0
0
US
I was recently grappling with this problem when putting together a family table. I was having trouble rounding a calculated value to the nearest integer to be displayed on a note in the drawing.

Before trying a lot of different calculations I did a google search and found this


ptc said:
Description: How to use round function
Applies To:
Pro/ENGINEER Wildfire 2.0 - 5.0 all datecodes,
Creo Elements/Pro 5.0 all datecodes
Creo Parametric 1.0 - 2.0 all datecodes

Resolution:
There is no direct function for round in relation than floor() and ceil().
To get mathematical round use one of the following formulas
no decimal place: A=floor(B+0.5) or A=ceil(B-0.4)
one decimal place: A=floor(B*10+0.5)/10 or A=ceil(B*10-0.4)/10
two decimal places: A=floor(B*100+0.5)/100 or A=ceil(B*100-0.4)/100

hope this helps somebody
 
Status
Not open for further replies.
Back
Top