> A Float may be smaller, but only because it > rounds off the last several digits of large values. ... > Not big losses, but when dealing with financial accounting > it is generally an unacceptable inaccuracy.
More to the point, if the DB rounds oddly, your attempts to access the data might fail. While you might enter a value as $12.99, the DB might store it as 12.990000001 or 12.899999999, potentially rendering a SELECT on that field usesless. DECIMAL (or NUMERIC) values are stored as strings and processed as numbers when they are accessed. This ensures that the value entered is the value stored. The 4-byte storage overhead is easily justified by this. Edward Dudlik Becoming Digital www.becomingdigital.com ----- Original Message ----- From: "Quinlan, Grant" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, 09 June, 2003 15:16 Subject: RE: money field I would use Decimal (12,2). A Float may be smaller, but only because it rounds off the last several digits of large values. A single-precision float uses 23 bits for storing digits, meaning that for values over 8,388,607 you are loosing pennies. When storing a value around 100 Million you would loose about 12 cents. Not big losses, but when dealing with financial accounting it is generally an unacceptable inaccuracy. Grant Q -----Original Message----- From: Mojtaba Faridzad [mailto:[EMAIL PROTECTED] Sent: Monday, June 09, 2003 11:56 AM To: [EMAIL PROTECTED] Subject: money field Hi, Which type do you usually use to keep money values? Decimal (12,2) or Float? to keep the first one, system takes 12 bytes but for the second one, 8 bytes. Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]