Dave Jolly 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
> 

Hi,

What you see is just normal.
FLOAT are internally stored as 32 bits floating point values.
They are by nature limited to 6 or 7 significant digits.
DOUBLE are 64 bits and have around 16 significant digits.

If even 16 digits is not enough, you should look at DECIMAL type.

Regards
--
Joseph Bueno
NetClub/Trader.com

---------------------------------------------------------------------
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

Reply via email to