List:General Discussion« Previous MessageNext Message »
From:Daniel Kasak Date:September 27 2005 12:43am
Subject:Re: money fields
View as plain text  
Jasper Bryant-Greene wrote:

> No way. You should *never* use floating-point types for currency if 
> you care about precision. You'll experience all sorts of weird 
> rounding and comparison errors. See [1] for more information.
>
> DECIMAL would suit your needs better -- from [2]: "The DECIMAL and 
> NUMERIC types [...] are used to store values for which it is important 
> to preserve exact precision, for example with monetary data."
>
> [1] http://en.wikipedia.org/wiki/Floating_point
> [2] http://dev.mysql.com/doc/mysql/en/numeric-types.html

I see.
Back to the drawing board then. I'm *sure* I saw someone else recommend 
that ... many years ago now.

-- 
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak@stripped
website: http://www.nusconsulting.com.au
Thread
money fieldsChris Ripley27 Sep
  • Re: money fieldsDaniel Kasak27 Sep
    • Re: money fieldsJasper Bryant-Greene27 Sep
      • Re: money fieldsDaniel Kasak27 Sep
  • Re: money fieldsPeter Brawley27 Sep