If th开发者_StackOverflow社区e decimal part is 0.1 to 0.12, it rounds down to the next lower integer If the decimal part is 0.13 to 0.37 it rounds to 0.25 If the decimal part is 0.38 to 0.62 it rounds to 0.5 If the decimal part is 0.63 to 0.87 it rounds to 0.75 If the decimal part is 0.88 or more, it rounds up to the next higher integer
Multiply by 4, round to the nearest integer, divide by 4?
There is a general method for this:
- Multiply your number by 4.
- Round to the nearest integer.
- Divide by 4.
In SQL:
ROUND(column * 4) / 4
I don't know the exact function name, but basically you use floor(4*x)/4. floor might be called int, to_int, or something like that.
精彩评论