Re: Numeric patch to add special-case representations for < 8 bytes - Mailing list pgsql-patches

From Gregory Stark
Subject Re: Numeric patch to add special-case representations for < 8 bytes
Date
Msg-id 87tzx5u2go.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: Numeric patch to add special-case representations for < 8 bytes  (Patric Bechtel <bechtel@ipcon.de>)
Responses Re: Numeric patch to add special-case representations for < 8 bytes
Re: Numeric patch to add special-case representations for < 8 bytes
List pgsql-patches
"Patric Bechtel" <bechtel@ipcon.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

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: xpath_array with namespaces support
Next
From: Patric Bechtel
Date:
Subject: Re: Numeric patch to add special-case representations for < 8 bytes