Re: function to format floats as money?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Mark Stosberg <mark(at)summersault(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: function to format floats as money?
Date: 2001-04-17 15:27:38
Message-ID: Pine.LNX.4.30.0104171724230.762-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Mark Stosberg writes:

> I'm curious to know if there is a function available in Postgres 7.0.3
> (or 7.1) that will format a float style number as "money". I understand
> that the money type is going away in the future, so using a float type
> that is sometimes formatted like money seems like a good alternative. So
> ideally, I'm looking for a solution that won't go away when the money type
> does. :) Thanks!

to_char() for formatting.

numeric for storage.

Using floats for monetary amounts is not only an extremely bad idea
because of the inexactness of storage and arithmetic, it might even be
illegal if you're using it for official purposes.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Mark Stosberg 2001-04-17 15:31:49 Re: function to format floats as money?
Previous Message Tom Lane 2001-04-17 15:21:22 Re: drastic reduction in speed of inserts as the table grows