Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

round to certain multiple of number

potrero

New member
I am aware of the floor() and ceil() functions. However, I am looking for a way to round a number to a multiple of another number.

For example, if I had:

num_original = 4.5205

and I wanted to round to the closest multiple of 0.5, the result would be:

num_rounded = 4.5

Is there a way to accomplish this in Pro/E?

Thanks!
 
Peter,
Thank you very much, of course your suggested method works well.

For the record, to round to a certain number of digits, "x", do the following:

num_rounded = floor(num_original * 1xx)/1xx

ie for 1 digit:
num_rounded = floor(num_original*10)/10

for 2 digits:
num_rounded = floor(num_original*100)/100

etc etc

Cheers
 

Sponsor

Back
Top