Re: How to sum monetary variables - Mailing list pgsql-general

From Craig Ringer
Subject Re: How to sum monetary variables
Date
Msg-id 4E24C7B1.7020306@postnewspapers.com.au
Whole thread Raw
In response to Re: How to sum monetary variables  (Merlin Moncure <mmoncure@gmail.com>)
List 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/

pgsql-general by date:

Previous
From: MS Rao
Date:
Subject: Programmer ( Postgres), Milwaukee - offsite-Remote - onsite
Next
From: Craig Ringer
Date:
Subject: Re: Alarm function in PL/pgSQL