Dialect 1. Not consistent result of two expressions with divide of NUMERIC with
scale
-------------------------------------------------------------------------------------
Key: CORE-6481
URL: http://tracker.firebirdsql.org/browse/CORE-6481
Project: Firebird Core
Issue Type: Bug
Components: Engine
Affects Versions: 3.0.8
Environment: Database with first dialect
Reporter: Kovalenko Dmitry
Priority: Minor
Not consistent result of two expressions with divide:
1. cast(2 as NUMERIC(2, 1)) / cast(3 as NUMERIC(2,0))
returns DOUBLE value: 0.6(6) without any information about scale
2. cast(cast(2 as NUMERIC(2, 1)) / cast(3 as NUMERIC(2,0)) AS VARCHAR(32))
returns VARCHAR value: 0.7
---------------
d:\Program_Files\Firebird_3_0_x64>isql
Use CONNECT or CREATE DATABASE to specify a database
SQL> CONNECT "inet4://localhost/d:\database\RAM\IBP_TEST_FB30_D1.GDB";
Database: "inet4://localhost/d:\database\RAM\IBP_TEST_FB30_D1.GDB", User:
HOME4\DIMA
SQL> SET SQLDA_DISPLAY ON;
SQL> select cast(2 as NUMERIC(2, 1)) / cast(3 as NUMERIC(2,0)) from dual;
INPUT message field count: 0
OUTPUT message field count: 1
01: sqltype: 480 DOUBLE scale: 0 subtype: 0 len: 8
: name: DIVIDE alias: DIVIDE
: table: owner:
DIVIDE
=======================
0.6666666666666666
SQL> select cast(cast(2 as NUMERIC(2, 1)) / cast(3 as NUMERIC(2,0)) AS
VARCHAR(32)) from dual;
INPUT message field count: 0
OUTPUT message field count: 1
01: sqltype: 448 VARYING scale: 0 subtype: 0 len: 32 charset: 0 NONE
: name: CAST alias: CAST
: table: owner:
CAST
================================
0.7
-------------------------------------
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel