Bug #45686 Double min or max values rounding error
Submitted: 23 Jun 2009 16:36 Modified: 26 Jun 2009 0:12
Reporter: Thomas Krüger Email Updates:
Status: Won't fix Impact on me:
None 
Category:MySQL Server: Data Types Severity:S2 (Serious)
Version:4.1, 5.0, 5.1 bzr OS:Any (MS Windows, Linux)
Assigned to: CPU Architecture:Any
Tags: double, MAX, min, precision, Rounding, truncation

[23 Jun 2009 16:36] Thomas Krüger
Description:
When issuing 

select cast(1.7976931348623157E+308 as char)

the returned value of 1.797693134862312E+308 is bigger than double max, which
produced the passed argument. The same applies to double min.
The value 1.7976931348623157E+308 is double max (.Net Framework & VC++ float.h)

That means, clients store double max values, which get rounded up while reading them in into the server, and when such rounded up values are retrieved by the client, the client gets an exception as the value exceeds the allowed range for double.

How to repeat:
select cast(1.7976931348623157E+308 as char)

Suggested fix:
Fix the reading / truncation / rounding code.
[24 Jun 2009 7:17] Sveta Smirnova
Thank you for the report.

Verified as described.

This is fixed in version 5.4 although I can not find earlier bug report about same problem.
[26 Jun 2009 0:13] Omer Barnir
issue fixed in next release 5.4)