这是为什么?
mysql版本号是 5.1.32-community
计算结果的错误是在自己程序中发现的,用MySQL控制台模拟了一下操作,还是如此。
请教大家,这是什么原因造成的?谢谢~use test;
drop table if exists test999;
create table test999 (f1 double);
insert into test999(f1)values(0.999999999999886);
select f1 - 1 from test999;
select 0.999999999999886-1 from test999;运行结果:
mysql> select f1 - 1 from test999;
+---------------------+
| f1 - 1              |
+---------------------+
| -1.14019904629e-013 |
+---------------------+mysql> select 0.999999999999886-1 from test999;
+---------------------+
| 0.999999999999886-1 |
+---------------------+
|  -0.000000000000114 |
+---------------------+