>>>>> "Bob" == Bob Kline <bkline@stripped> writes:
Bob> On Fri, 29 Oct 1999, Arne Mueller wrote:
>> It's a bug in mysql in older version 3.23.
>>
>> You need version 3.23 (still alpha) to solve the problem unless you
>> decide to store your small numbers as strings. In mysql 3.34 you
>> have the type float(precision) working correctly, precision can be 4
>> or 8 (in bytes).
>>
Bob> Unfortunately, there are still a number of problems with the FLOAT
Bob> implementation in 3.23.
Bob> The first is that FLOAT(8) is not specifying precision, it's specifying
Bob> storage requirements in bytes. So you can't use this syntax if you want
Bob> to write portable SQL, because in standard SQL it means you want (a
Bob> minimum of) 8 bits of precision in your mantissa.
Bob> Worse (and this is still true in 3.23) if you do use the standard FLOAT
Bob> (without a precision specifier) to avoid the first problem, MySQL
Bob> silently adds semantics which truncate the number of decimal digits
Bob> following the decimal point:
Bob> Welcome to the MySQL monitor. Commands end with ; or \g.
Bob> Your MySQL connection id is 15 to server version: 3.23.4-alpha-log
Bob> Type 'help' for help.
mysql> CREATE TABLE ftest(f FLOAT);
Bob> Query OK, 0 rows affected (0.00 sec)
mysql> INSERT INTO ftest VALUES(.004);
Bob> Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO ftest VALUES(.004);
Bob> Query OK, 1 row affected (0.00 sec)
mysql> INSERT INTO ftest VALUES(.004);
Bob> Query OK, 1 row affected (0.00 sec)
mysql> SELECT SUM(f) FROM ftest;
Bob> +--------+
Bob> | SUM(f) |
Bob> +--------+
Bob> | 0.00 |
Bob> +--------+
Bob> 1 row in set (0.00 sec)
Bob> I'm running 3.23.4, and I don't see any entires in the change log for
Bob> 3.23.5 indicating a fix for this behavior.
Hi!
I have now fixed for MySQL 3.23.6 that FLOAT and DOUBLE without length
modifiers is the same as FLOAT(4) and FLOAT(8) (not fixed point numbers)
Regards,
Monty