On 5/13/21 3:47 PM, Mark Rotteveel wrote:
I'm in the process of writing the Firebird 4.0 Language Reference, and I'm noticing some odd things with numeric literals and INT128 (including numeric types) and DECFLOAT.


2. Exact numeric literals with 30 or more digits are handled as DECFLOAT(34), they should be handled as INT128 or DECIMAL/NUMERIC backed by INT128 (as those types support 38 digits; actually 39 for INT128).

The cut off point for handling long exact numeric literals should be at 38 digits (or maybe, if no decimal point is present, at INT128 max of 7FFF FFFF FFFF FFFF FFFF FFFF FFFF FFFF), longer values should be handled as DECFLOAT.

I haven't created a ticket for point 2 yet, as I was wondering if maybe this was a deliberate choice, or is this a left-over of the earlier situation when high-precision numerics were backed by DECFLOAT?


Mark, this works for me (37 digits):

SQL> set sqlda_display;
SQL> select 1234567890123456789012345678901234567 from rdb$database;

INPUT message field count: 0

OUTPUT message field count: 1
01: sqltype: 32752 INT128 scale: 0 subtype: 0 len: 16
  :  name: CONSTANT  alias: CONSTANT
  : table:   owner:

                                     CONSTANT
=============================================
        1234567890123456789012345678901234567




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

Reply via email to