Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateInternal functions → ROUND()
Firebird Home Firebird Home Prev: RIGHT()Firebird Documentation IndexUp: Internal functionsNext: RPAD()

ROUND()

Available in: DSQL, PSQL

Added in: 2.1

Description: Rounds a number to the nearest integer. If the fractional part is exactly 0.5, rounding is upward for positive numbers and downward for negative numbers. With the optional scale argument, the number can be rounded to powers-of-ten multiples (tens, hundreds, tenths, hundredths, etc.) instead of just integers.

Result type: INTEGER, (scaled) BIGINT or DOUBLE

Syntax: 

ROUND (<number> [, <scale>])

<number>  ::=  a numerical expression
<scale>   ::=  an integer specifying the number of decimal places
               toward which should be rounded, e.g.:
                  2 for rounding to the nearest multiple of 0.01
                  1 for rounding to the nearest multiple of 0.1
                  0 for rounding to the nearest whole number
                 -1 for rounding to the nearest multiple of 10
                 -2 for rounding to the nearest multiple of 100

Notes: 

Important

  • If the external function ROUND is declared in your database, it will override the internal function. To make the internal function available, DROP or ALTER the external function (UDF).

  • If you are used to the behaviour of the external function ROUND, please notice that the internal function always rounds halves away from zero, i.e. downward for negative numbers.

Prev: RIGHT()Firebird Documentation IndexUp: Internal functionsNext: RPAD()
Firebird Documentation IndexFirebird 2.5 Language Ref. UpdateInternal functions → ROUND()