Bug #12956 cast make differ rounding
Submitted: 2 Sep 2005 18:42 Modified: 9 Dec 2005 19:41
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0 OS:Any (all)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[2 Sep 2005 18:42] Oleksandr Byelkin
Description:
direct conversion from floating point and convertion via CAST function give different results.
+ create table t1 (a int);
+ insert into t1 values  (55e-1*1e0), (cast(55e-1*1e0 as unsigned integer));
+ select * from t1;
+ a
+ 6
+ 5
+ drop table t1;

bug appeared to be in 4.0, 4.1 and 5,0 versions

How to repeat:
use following mysql-test script:
create table t1 (a int);
insert into t1 values  (55e-1*1e0), (cast(55e-1*1e0 as unsigned integer));
select * from t1;
drop table t1;

Suggested fix:
fix cast function
[28 Nov 2005 10:54] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/32752
[29 Nov 2005 14:08] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/32827
[30 Nov 2005 7:18] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/internals/32848
[2 Dec 2005 11:28] Ramil Kalimullin
fixed in 5.0.17
[9 Dec 2005 19:41] Paul DuBois
Noted in 5.0.17 changelog.