Re: Decimal64 and Decimal128

From: Craig Ringer <craig(at)2ndquadrant(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Peter Geoghegan <pg(at)heroku(dot)com>, Feng Tian <ftian(at)vitessedata(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Decimal64 and Decimal128
Date: 2017-06-16 01:24:28
Message-ID: CAMsr+YG7vu5G4-QRUJczg0mdHzY5P=1Rvzi-iwKTb=u5QpAngA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 16 June 2017 at 05:42, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> On Fri, Sep 25, 2015 at 5:06 PM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
>> 2015-09-25 0:25 GMT+02:00 Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>:
>>>
>>> On 9/24/15 3:35 PM, Peter Geoghegan wrote:
>>>>
>>>> I would worry about the implicit casts you've added. They might cause
>>>> problems.
>>>
>>>
>>> Given the cycle created between numeric->decimal and decimal->numeric, I
>>> can pretty much guarantee they will. In any case, I don't think implicit
>>> casting from numeric->decimal is a good idea since it can overflow. I'm not
>>> sure that the other direction is safe either... I can't remember offhand if
>>> casting correctly obeys typmod or not.
>>>
>>> BTW, have you talked to Pavel about making these changes to his code?
>>> Seems a shame to needlessly fork it. :/
>>
>>
>> yes, he talked with me, and I gave a agreement to continue/enhance/fork this
>> project how will be necessary
>
> Bumping this ancient thread to say that DECFLOAT appears to have
> landed in the SQL standard. I haven't looked at SQL:2016 myself by I
> just saw this on Markus Winand's Modern SQL blog:
>
> "There is a new type decfloat[(<precision>)] (T076)."
>
> http://modern-sql.com/blog/2017-06/whats-new-in-sql-2016
>
> So far it's supported only by DB2 (inventor) and FirebirdSQL has just
> announced support in the next release.

I was pretty excited by decimal floating point initially, but the lack
of support for its use in hardware in commonplace CPUs makes me less
thrilled. IIRC Intel was talking about adding it, but I can't find any
references to that anymore. POWER6 and POWER7 has it, which is great,
but hardly justifies a push for getting it into the core Pg.

Some of the discussion on
https://software.intel.com/en-us/articles/intel-decimal-floating-point-math-library?page=1
suggests that doing it fully in hardware is very expensive, so a mixed
software/microcode implementation with some hardware assistance is
likely if/when it comes.

--
Craig Ringer http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Craig Ringer 2017-06-16 01:29:38 Re: logical replication read-only slave
Previous Message Tsunakawa, Takayuki 2017-06-16 00:34:35 Re: Huge pages support on Windows