I wrote:
then let me refine that to (except for the special cases):
floor: ceil:
patch diagram snipped ...
that 'special cases' include negative nr.s of course, so I made http://lo-res.org/~x/nolink/ceilfloor.tar.gz - use the power of -lm of your os of choice.
;)
x