On 2013-03-28, D'Arcy J.M. Cain <darcy@druid.net> wrote:
>
> I would like to see the type handle other situations such as foreign
> (to me) currency, etc. I suppose a positional parameter and a currency
> string setting would handle most of those issues. Technically, the
> money type is a cents type. Everything is stored as the number of
> cents. Formatting it as dollars and cents is a convenience added by
> the I/O functions.
it actually does that, if you have the locale installed you can set
LC_MONETARY to Japan and get no decimals and a Yen symbol
or to UAE and get three decimals and their currency symbol.
> Even as the author I sometimes go with numeric but there is a place for
> the type. If you are working with simple dollars and cents quantities
> and you need to do lots of calculations on them, the money type can be
> a great performance boost. The big win that money brings is that
> everything is stored as an int. That means that you don't need to
> convert data in the database to a machine representation before
> summing, averaging, etc. The machine can generally work on the data as
> it comes out of the DB.
it'd be nice to be able to do a money * numeric operation
currently multiplication is done in floating point and this can give
unexpected results.
>
> --
> D'Arcy J.M. Cain <darcy@druid.net> | Democracy is three wolves
> http://www.druid.net/darcy/ | and a sheep voting on
> +1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.
> IM: darcy@Vex.Net, VOIP: sip:darcy@Vex.Net
>
>
--
⚂⚃ 100% natural