Hmm... fishy. For ceiling the integer should indeed have been compensated:
Code:
FUNCTION ceiling RETURNS DECIMAL (
i_de AS DECIMAL
):
RETURN
IF i_de = TRUNCATE( i_de, 0 ) THEN
i_de
ELSE
ROUND( i_de + 0.5, 0 ).
END FUNCTION.
I can however make neither heads nor tails of the requirement:
- when x is greater than 0 and less than 5, 1 should be added - what should happen when x >= 5 and x <= 9?
- how many digits can x be?
If it were ceiling then 5 thru 9 would also round up.