At 13:13 -0700 5/30/06, Jeremy Cole wrote:
Hi Wang,

 select 9000000000000.10*19.80 wrong result 178200000000001.97
     if <= 900000000000.10*19.80 right  result    17820000000001.98
This is similiar to sum(qty*unitpri) result .

Welcome to the world of floating point arithmetic. If you need such precision, try MySQL 5.0, as it should be capable of doing that calculation using its new precision math support.

Yep.

MySQL 5.0, 5.1:

mysql> select 9000000000000.10*19.80;
+------------------------+
| 9000000000000.10*19.80 |
+------------------------+
|   178200000000001.9800 |
+------------------------+

MySQL 3.23, 4.0, 5.1:

mysql> select 9000000000000.10*19.80;
+------------------------+
| 9000000000000.10*19.80 |
+------------------------+
|     178200000000001.97 |
+------------------------+

--
Paul DuBois, MySQL Documentation Team
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to