Re: IEEE 754-2008 decimal numbers

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Thomas Munro <munro(at)ip9(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: IEEE 754-2008 decimal numbers
Date: 2010-10-11 01:40:38
Message-ID: 4CB26B16.7080602@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 10/11/2010 04:46 AM, Thomas Munro wrote:

> Has anyone done any work on IEEE 754-2008 decimal types for PostgreSQL?

I haven't seen any discussion. Perhaps you should ask on pgsql-hackers@
as well, as some folks who might've tried it read that list but not this
one.

> I couldn't find anything, so I was thinking it might be a fun exercise
> for learning about extending PostgreSQL with user defined types. My
> first goal is to be able to store decimal numbers with a smaller disk
> footprint than NUMERIC.

NUMERIC just got a smaller header in 9.1, but AFAIK is still binary
coded decimal (BCD). A smaller and possibly faster fixed-precision
numeric would certainly be awfully nice. Not everybody needs perfect
precision, only tightly controlled precision with sane and controllable
rounding rules.

What I'd give for rounding rule control with numeric types....

> (A more ambitious project for later would be defining
> arithmetic operators etc using compiler/hardware support).

Hmm, yes. I didn't realize c99 added these. gcc's documentation says
that this support is "only activated on certain targets" - meaning
possibly limited platform/cpu support?

http://gcc.gnu.org/onlinedocs/gccint/Decimal-float-library-routines.html

It seems to have been added in gcc 4.3. It has hardware decimal floating
point support on zseries

There's also Intel's Decimal Floating-Point Math Library , which seems
to be BSD licensed, and is apparently what the gcc decimal floating
point support is based on.

http://software.intel.com/en-us/articles/intel-decimal-floating-point-math-library/

http://software.intel.com/en-us/blogs/2008/03/06/intel-decimal-floating-point-math-library/

--
Craig Ringer

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darren Duncan 2010-10-11 02:29:24 Re: IEEE 754-2008 decimal numbers
Previous Message Ben Carbery 2010-10-10 22:38:34 Re: rotate psql output