Re: Money casting too liberal? - Mailing list pgsql-general

From John R Pierce
Subject Re: Money casting too liberal?
Date
Msg-id 515B208B.2040606@hogranch.com
Whole thread Raw
In response to Re: Money casting too liberal?  (Gavin Flower <GavinFlower@archidevsys.co.nz>)
Responses Re: Money casting too liberal?
List pgsql-general
On 4/2/2013 12:50 AM, Gavin Flower wrote:
In the bad old days when I was a COBOL programmer we always stored money in the COBOL equivalent of an integer (numeric without a fractional part) to avoid round off, but we displayed with a decimal point to digits to the left.  So storing as an integer (actually bigint would be required) is a good idea, with parameters to say how many effective digits in the fractional part, and how many fractional digits to display etc. - as you said.

COBOL Numeric was BCD.   same as NUMERIC in SQL (yes, I know postgresql internally uses a base 10000 notation for this, storing it as an array of short ints, but effectively its equivalent to BCD).





-- 
john r pierce                                      37N 122W
somewhere on the middle of the left coast

pgsql-general by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: Using varchar primary keys.
Next
From: Misa Simic
Date:
Subject: Re: Dynamic/polymorphic record/composite return types for C user-defined-functions