Re: How to sum monetary variables

From: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
To: Merlin Moncure <mmoncure(at)gmail(dot)com>
Cc: Martín Marqués <martin(dot)marques(at)gmail(dot)com>, pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to sum monetary variables
Date: 2011-07-18 23:54:25
Message-ID: 4E24C7B1.7020306@postnewspapers.com.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 19/07/2011 6:04 AM, Merlin Moncure wrote:
> I wouldn't even bother testing client implementations that are using
> floating point numbers to do the math -- they are going to be wrong.
> If you snoop around you should find math libraries that handle do a
> better job handling exact numbers for most popular languages.

You'll also need to convince your database interface to use the decimal
library you choose, or get it to return 'numeric' types as strings so
you can convert them with your chosen library yourself.

It'll do you no good to convert from Pg numeric -> floating point ->
exact decimal library format.

--
Craig Ringer

POST Newspapers
276 Onslow Rd, Shenton Park
Ph: 08 9381 3088 Fax: 08 9388 2258
ABN: 50 008 917 717
http://www.postnewspapers.com.au/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Craig Ringer 2011-07-18 23:56:15 Re: Alarm function in PL/pgSQL
Previous Message Darren Duncan 2011-07-18 22:47:18 Re: Alarm function in PL/pgSQL