basically, take the trunc(x) and add to it:
0.00 <= x < 0.25 => +0
0.25 <= x < 0.75 => +0.5
0.75 <= x < 1.00 => +1.0
so, math:
ops$tkyte%ORA11GR1> create table t ( x number );
Table created.
ops$tkyte%ORA11GR1> insert into t select rownum *0.05 from all_users where rownum < 20;
19 rows created.
ops$tkyte%ORA11GR1> insert into t select x+0.04 from t;
19 rows created.
ops$tkyte%ORA11GR1> select x, ceil((x-0.25+0.001)*2)/2 from t order by x;
X CEIL((X-0.25+0.001)*2)/2
---------- ------------------------
.05 0
...
.24 0
.25 .5
...
.74 .5
.75 1
...
.99 1
38 rows selected.and a quick test
ops$tkyte%ORA11GR1> truncate table t;
Table truncated.
ops$tkyte%ORA11GR1> insert into t values ( 1.11 );
1 row created.
ops$tkyte%ORA11GR1> insert into t values ( 1.25 );
1 row created.
ops$tkyte%ORA11GR1> insert into t values ( 5.6 );
1 row created.
ops$tkyte%ORA11GR1> insert into t values ( 2.75 );
1 row created.
ops$tkyte%ORA11GR1>
ops$tkyte%ORA11GR1> select x, floor(x) + ceil(( (x-trunc(x)) - 0.25+0.001)*2)/2 from t order by x;
X FLOOR(X)+CEIL(((X-TRUNC(X))-0.25+0.001)*2)/2
---------- --------------------------------------------
1.11 1
1.25 1.5
2.75 3
5.6 5.5
Now, doesn't do negatives - but you see the approach, you'd be able to add that if you wanted...