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!

rounding expression to nearest .25"

Status
Not open for further replies.

multicaduser

Industrial
Jan 29, 2013
261
Must be brain fog, I know how to round an expression to any number of decimal places, how to use floor and ceiling, but am having a dickens of a time figuring out how to round to the nearest .25.

This formula always rounds up
ceiling(4*x)/4

This formula always rounds down
floor(4*x)/4

Examples of what I'm trying to accomplish
1.2 to 1.25
1.4 to 1.5
1.8 to 1.75
1.9 to 2

I know a long conditional statement to choose which formula will work but was wondering if some more elegant. Any ideas?


NX 1899 Windows 10
 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor