Mark & others - this is missing email

-------- Forwarded Message --------
Subject: Re: [Firebird-devel] DEC_FIXED implementation, Decimal128 is unscaled?
Date:   Fri, 2 Feb 2018 21:32:46 +0300
From:   Alex Peshkoff <peshk...@mail.ru>
To:     Dimitry Sibiryakov <s...@ibphoenix.com>



On 02/02/18 21:15, Dimitry Sibiryakov wrote:
02.02.2018 19:08, Alex Peshkoff wrote:
On 02/02/18 19:40, Dimitry Sibiryakov wrote:
02.02.2018 17:25, Alex Peshkoff via Firebird-devel wrote:
I.e. to represent NUMERIC/DECIMAL(M, N) where M > 18 will be used SQL_DEC34 with sqlsubtype 1/2? But what should be the value of sql_scale? On the one hand in should be non-zero to let user know how many digits after decimal point may be used. On the other - for non-zero scale in numeric fields we always used to follow the rule: value = basic-type-value * pow(10, -scale) but most of people here tend to require SQL_DEC34 to be already scaled correctly.

  Because SQL_DEC* values according to IEEE are, actually, floating-point values, they must be treated the same way as SQL_FLOAT and SQL_DOUBLE, IMHO.

I.e. like numerics based on SQL_DOUBLE in dialect 1?

  Yes. AFAIR, they are not scaled

Yes.

and sqlscale is always zero for them.


No - it's not zero, it's according to initial DDL for a field. When
displaying a field it's used to correctly choose number of digits after
decimal point. (Double number may be something like 178500178500.17001
but with scale == -2 it will be displayed as 178500178500.17). For
decfloat there will be no need to play that games, correct number of
digits after decimal points will be enforced by engine, but notifying
user about the scale is anyway good idea, is not it?

For scaled integers (SQL_LONG, SQL_INT64) the value is supposed to be a real integer which, for example, can be divided by 2 using bitwise shifts. AFAIU, fixed decfloat cannot be divided this way, right?


Right. Decfloat format is looking much closer to double (has exponent
and coefficient parts) than to integer.


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to