Subject Rounding large numbers
Author marrtins_dqdp
Hello!

I have few servers with Firebird versions. On some servers live
version 2.0.4 on others 2.1.0

I need to round one column with precision 4 digits. It is done via
trigger. Column is defined as DOUBLE PRECISION

On 2.1.0 I do
new.TOTAL = ROUND(new.TOTAL, 4);

On 2.0.4 I do
new.TOTAL = ROUND(CAST(new.TOTAL * 10000 AS INTEGER)) / 10000;

Both worked fine till today new.TOTAL hit 1482835105.6 in one row,
which gave me 0.0000 on v2.1.0 and `arithmetic exception, numeric
overflow, or string truncation` on v2.0.4

Someone may test it
v2.1.0
SELECT ROUND(1482835105.6, 4)
FROM RDB$DATABASE

v.2.0.4
SELECT ROUND(CAST(1482835105.6 * 10000 AS INTEGER)) / 10000
FROM RDB$DATABASE

My question is - how to round such large numbers?

Thank you!