ara.t.howard / noaa.gov wrote:
> On Thu, 23 Nov 2006, John Kopanas wrote:
>
> > I have a number that is of type float.  I want to format it as dollars
> > and cents.  How do you recommend I do it? :-)
>
> never, never, never use floats to represent money.
>
> http://en.wikipedia.org/wiki/Fixed-point_arithmetic

I'm very happy someone said that. But to expand on at least one reason
why:

In many countries the taxman will be very unhappy, as things like
VAT/sales tax often have _very_ specific rules about how rounding and
fractions should be handled (i.e. UK regulations specify two
alternative methods that it's your responsibility to ensure your
results matches to the penny if you generate VAT invoices).

Vidar