Alex Peshkoff via Firebird-devel <firebird-devel@lists.sourceforge.net> wrote Fri, 21 Jun 2019 16:53:26 +0300:

I've compared various possible implementations of high precision numeric. Except existing in fb4 (decfloat based) were checked native gcc's __int128 and ttmath (fixed high precision library with pure .h implementation). Test performed a mix of sum/mult/div operations in a loop. Native code was compiled w/o opimization - even with -O1 loop was optimized and test completed at once.


I have a few questions about https://github.com/FirebirdSQL/firebird/pull/220

SQL> show version;
ISQL Version: WI-T4.0.0.1603 Firebird 4.0 Beta 1
Server version:
Firebird/Windows/AMD/Intel/x64 (access method), version "WI-T4.0.0.1603 Firebird 4.0 Beta 1" Firebird/Windows/AMD/Intel/x64 (remote server), version "WI-T4.0.0.1603 Firebird 4.0 Beta 1/tcp (DESKTOP-E3INAFT)/P16:C" Firebird/Windows/AMD/Intel/x64 (remote interface), version "WI-T4.0.0.1603 Firebird 4.0 Beta 1/tcp (DESKTOP-E3INAFT)/P16:C"
on disk structure version 13.0

Used version compiled by appveyor

SQL> set sqlda_display on;
SQL> select 12345678901234567890 as n from rdb$database;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 32762 DECFLOAT(34) scale: 0 subtype: 0 len: 16
  :  name: CONSTANT  alias: N
  : table:   owner:

                                         N
==========================================
                      12345678901234567890

Should constants be of type DECFLOAT (34)?

SQL> select cast(12345678901234567890 as numeric(25, 0)) as n from rdb$database;
Statement failed, SQLSTATE = 22003
arithmetic exception, numeric overflow, or string truncation
-numeric value is out of range

It seems isql does not yet have native support for int128.

SQL> set int128 bind char;
SQL> select cast(12345678901234567890 as numeric(25, 0)) as n from rdb$database;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 452 TEXT scale: 0 subtype: 0 len: 45 charset: 2 ASCII
  :  name: CAST  alias: N
  : table:   owner:

N
=============================================
12345678901234567890

If you bind to char, then everything works.

--
Simonov Denis



Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to