I'd recommend decimal(10,2), myself.
Matthew Walker
Ecommerce Project Manager
Mountain Top Herbs
-----Original Message-----
From: steve@stripped [mailto:steve@stripped]
Sent: Saturday, January 26, 2002 5:57 PM
To: Shankar Unni
Cc: mysql@stripped
Subject: Re: most appropriate data type for currency?
For currency, it depends on your use of course, but fixed-point is
usually easiest. Where you fix the point depends on the precision
you require.
For display purposes it is easiest to use the smallest currency
unit as an integer (e.g. cents). For conversions, daily interest,
etc, you can do the same but with a few extra decimal points to
keep rounding errors small and predictable.
For cases where the errors would tend to accumulate (banking etc)
I think you need a Double.
I can't imagine a case where I would use a Float.
Steve
> Of course, in the interests of fairness, I should note that typical
doubles
> (64-bit IEEE) have about 15 digits of accuracy, which are generally
enough,
> as long as you never exceed 10**13 dollars (i.e. no US govt budget
work
> :-)). You only have to worry about precise rounding with doubles.
> --
> Shankar
>
> (PS Of course, given the typical accuracy with which budget numbers
are
> tossed around, one would suspect that our fine reps use floats to
> manipulate them..)
>
>
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <mysql-thread97582@stripped>
> To unsubscribe, e-mail
<mysql-unsubscribe-steve=petabit.com@stripped>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <mysql-thread97584@stripped>
To unsubscribe, e-mail
<mysql-unsubscribe-matt=mountaintopherbs.com@stripped>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.317 / Virus Database: 176 - Release Date: 1/21/2002