round, i64round

Description: These functions return the whole number that is nearest to their (scaled numeric/decimal) argument. They do not work with
floats or doubles.

Result type: INTEGER / NUMERIC(18,4)

Syntax:

round (number)
i64round (bignumber)

Caution

Halves are always rounded upward, i.e. away from zero for positive numbers and toward zero for negative numbers. For instance,
3.5 is rounded to 4, but -3.5 is rounded to -3. The internal function ROUND, available since Firebird 2.1, rounds all halves away from zero.

Bug alert

In versions 2.1, 2.1.1 and 2.1.2, these functions are broken for negative numbers:

Anything between 0 and -0.6 (that's right: -0.6, not -0.5) is rounded to 0.

If you move an existing database from Firebird 1.0.x to 1.5 or higher, drop any existing *round and *truncate declarations and declare them anew, using the updated entry point names. From Firebird 2.0 onward you can also perform this
update with ALTER EXTERNAL FUNCTION.