Subject | Numeric(18,bug) |
---|---|
Author | Claudio Valderrama C. |
Post date | 2002-02-16T04:45:59Z |
This is a view that encapsulates Guido's example. I put only two columns at
once to avoid wrapping:
SQL> select * from dial3;
M1 M1V
============ =====================
-70000.0000 -35790.431683735
M2 M2V
============ =====================
-70000.0000 -35790.431683735
M3 M3V
============ =====================
-70000.00000 -35790.4316837350
This is the example mine that produced zero by doing
(-4611686018427387904)/-0.5 and that doesn't fit really:
SQL> select * from muldetect;
CANT
=====================
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation
Now, directly:
SQL> select cast (-70000 as numeric (18,5)) / cast (1.95583 as numeric
(18,5)) from rdb$database;
=====================
-35790.4316837350
Just to be sure positive numbers weren't stuffed:
SQL> select cast (+70000 as numeric (18,5)) / cast (1.95583 as numeric
(18,5)) from rdb$database;
=====================
35790.4316837350
The bug? Gone in 7 minutes. No joke.
C.
---------
Claudio Valderrama C.
Ingeniero en Informática - Consultor independiente
http://www.cvalde.com - http://www.firebirdSQL.org
once to avoid wrapping:
SQL> select * from dial3;
M1 M1V
============ =====================
-70000.0000 -35790.431683735
M2 M2V
============ =====================
-70000.0000 -35790.431683735
M3 M3V
============ =====================
-70000.00000 -35790.4316837350
This is the example mine that produced zero by doing
(-4611686018427387904)/-0.5 and that doesn't fit really:
SQL> select * from muldetect;
CANT
=====================
Statement failed, SQLCODE = -802
arithmetic exception, numeric overflow, or string truncation
Now, directly:
SQL> select cast (-70000 as numeric (18,5)) / cast (1.95583 as numeric
(18,5)) from rdb$database;
=====================
-35790.4316837350
Just to be sure positive numbers weren't stuffed:
SQL> select cast (+70000 as numeric (18,5)) / cast (1.95583 as numeric
(18,5)) from rdb$database;
=====================
35790.4316837350
The bug? Gone in 7 minutes. No joke.
C.
---------
Claudio Valderrama C.
Ingeniero en Informática - Consultor independiente
http://www.cvalde.com - http://www.firebirdSQL.org