.1 can not be represented exactly on a binary machine. there must be an 
approximation stored in the fractional bits of the floating point 
representation. there are more fractional bits in a double than in a float. 
so the approximation is better. see the user manual for exact sizes.

At 12:51 PM 8/14/01 -0400, you wrote:
>Hi,
>
>There seems to be a round-off problem with FLOAT.
>
>Here's a scenario to replicate it...
>
><-------------->
>$ mysql
>
>Welcome to the MySQL monitor.  Commands end with ; or \g.
>Your MySQL connection id is 1149 to server version: 3.23.41
>
>Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
>
>mysql> CREATE TABLE crap (blah float(10,2) DEFAULT '0.00' NOT NULL, blah2
>double(10,2));
>Query OK, 0 rows affected (0.00 sec)
>
>mysql> insert into crap VALUES ('211710.10','211710.10');
>Query OK, 1 row affected (0.00 sec)
>
>mysql> select * from crap;
>
>+-----------+-----------+
>| blah      | blah2     |
>+-----------+-----------+
>| 211710.09 | 211710.10 |
>+-----------+-----------+
>1 row in set (0.00 sec)
>
>mysql> /q
>
><-------------->
>
>Everything works with DOUBLE fine as you can see.
>
>Just thought i'd bring it to someone's attention.  FLOAT seems to work with
>smaller numbers but when the values start getting big, this sort of thing
>starts happening.
>
>Thanks
>
>Dave
>
>
>---------------------------------------------------------------------
>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 <[EMAIL PROTECTED]>
>To unsubscribe, e-mail 
><[EMAIL PROTECTED]>
>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


----------
tom marlin
[EMAIL PROTECTED]
fax / voice mail: 714 507 3802 ext 4881
My mind wanders a lot; sometimes it leaves completely.
                    - Duncan Hill

Reply via email to