yarex(at)pobox(dot)sk writes:
> url: https://www.postgresql.org/docs/8.1/static/functions-math.html
> CEIL and FLOOR example is not accurate.
> ceil(dp or numeric)
> smallest integer not less than argument: ceil(-42.8) = -42
That example is just fine: it describes both the actual behavior
of the software, and the desired behavior. ceil() is effectively
"round towards plus infinity". You seem to be expecting "round
away from zero", but that's not how it's defined. For comparison,
the Linux man page for the C ceil() function says
For example, ceil(0.5) is 1.0, and ceil(-0.5) is 0.0.
regards, tom lane