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
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