Re: Numeric patch to add special-case representations for < 8 bytes

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Patric Bechtel" <bechtel(at)ipcon(dot)de>
Cc: "pgsql-patches" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: Numeric patch to add special-case representations for < 8 bytes
Date: 2007-03-01 02:23:03
Message-ID: 87tzx5u2go.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


"Patric Bechtel" <bechtel(at)ipcon(dot)de> writes:

> Maybe you want to have a look here:
> http://www2.hursley.ibm.com/decimal/DPDecimal.html

Well we're not really looking for the optimal packing in general. All the
problems here have to do with convenience in the implementation rather than
the problems with the approach. It's easier in the code to have fixed size
scale and weight and to have them at the beginning of the data type, which is
fine for larger values but for small values they dominate and waste space.

But as far as the approach goes, I admit I find it a bit hard to believe that
we're still doing BCD in the 21st century at all.

If we stored the digits in base 2 with a base 10 exponent would it really be
too hard to output the digits? Even long multiplication and then reversing the
results doesn't seem like it would be too bad and surely there must exist
reasonable algorithms to do better.

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Patric Bechtel 2007-03-01 03:32:55 Re: Numeric patch to add special-case representations for < 8 bytes
Previous Message Bruce Momjian 2007-03-01 02:11:45 Re: xpath_array with namespaces support