On 16.09.2019 23:17, Simonov Denis via Firebird-devel wrote:
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)?
That's not a bug but worth looking at.
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
That's very strange - that works for me.
It seems isql does not yet have native support for int128.
Please create a table with numeric(25, 0) and try to work (insert,
select) with it.
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.
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel