Bug #12440 CAST(data type DOUBLE AS TIME) strange results
Submitted: 8 Aug 2005 16:37 Modified: 19 Jan 2006 21:36
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1 OS:
Assigned to: Alexander Ivanov CPU Architecture:Any

[8 Aug 2005 16:37] Matthias Leich
Description:
SELECT CAST(+3.3E+0 AS TIME);
CAST(+3.3E+0 AS TIME)
00:00:03.300000    (1), (2), (3)
But the manual says: 
  MySQL retrieves and displays TIME values in 'HH:MM:SS' format.
So the value above violates the specification from the manual.

SELECT CAST(-1.7976931348623e+308 AS TIME);
CAST(-1.7976931348623e+308 AS TIME)
-00:00:01.96520853    (1)
               ### There is the annoying fraction, but the value differs also 
                from the mantissa of the double.
-00:00:01                    (2)
-00:00:01.797693        (3)
Warning	1292	Truncated incorrect time value: '-1.7976931348623e+308'
                       (3) 
                       I do not know, if (1) and (2) get also this warning.

(1) Windows XP Prof. + MySQL 5.0.10a-beta-nt-log Win32 
     Box of CarstenS
(2) Win XP with VMware, SuSE 9.3 within VM
     + MySQL 5.0  binaries around 31 July
     Box of OBN
(3) SuSE 9.3 + MySQL 5.0 compiled from source
     I had these results with last Changeset around 15 July
     and have them today
     last ChangeSet@1.1960, 2005-08-08 
           5.0.12-beta-debug-log suse-linux

How to repeat:
Please execute the statements above.
[26 Sep 2005 18:12] 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/30341
[3 Oct 2005 10:22] 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/30629
[15 Dec 2005 15:36] 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/commits/181
[16 Dec 2005 16:08] Alexander Ivanov
Fixed in 4.1.17, 5.0.18
[19 Jan 2006 21:36] Mike Hillyer
Added not to appropriate changelogs:

 <listitem>
        <para>
          Using <function>CAST()</function> to convert values with long fractional and/or
          exponent parts returned wrong results. (Bug #12440)
        </para>
      </listitem>
[19 Jan 2006 21:36] Mike Hillyer
Added portion mentioning that the conversion was to a TIME value.