Bug #5021 Format Function return different values on Windows and Linux
Submitted: 12 Aug 2004 16:20 Modified: 29 Sep 2008 17:19
Reporter: Felipe Riccetto Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.3b-beta-nt-max-log OS:Microsoft Windows (Windows XP Pro)
Assigned to: Konstantin Osipov CPU Architecture:Any

[12 Aug 2004 16:20] Felipe Riccetto
Description:
When I execute:

"select format(7.8960168039E11,6)"

on Windows XP Pro or Windows 2000 Server returns: "789,601,680,389.999880",
and on Linux (Fedora) returns = "789,601,680,390.00"

--------------------------
MySQL Version:
On Windows: 4.1.3b-beta-nt-max-log
On Linux: 4.1.3b-stantard

How to repeat:
Execute: "select format(7.8960168039E11,6)" on Windows and on Linux and see the returned values.
[12 Aug 2004 21:34] Hartmut Holzgraefe
4.1.1 on windows returned the right result (same as linux),
4.1.3 somehow lost some precision here
[12 Aug 2004 22:52] Brian Aker
Hi!

This is not a bug. Currently display of numbers is system dependent. We are looking into fixing 
this in a later release.
[14 Aug 2004 2:30] Felipe Riccetto
--Try to execute this test case:

create database test;
use test;

create table test (number double);

insert into test values(7.8960168039E11);

select number from test;
--the result is: 789601680390

--but when I execute the query below
select * from test where number=789601680390;
--it return 0 rows. This is, at least, strange...

--now, execute the query:
select format(number,6) from test
--it will return: 789,601,680,389.999880
[14 Aug 2004 11:35] Sergei Golubchik
Strange. But it is how Windows printf() rounds numbers when printing.
And for now MySQL relies of system printf() yet.

In the later releases we will do float->string conversion in MySQL, removing dependency on incompatible system implementations.
[25 Aug 2004 19:03] Brian Aker
Hi!

This is a known and documented issue between versions. We will be looking at fixing this in a 
later release of MySQL.
[29 Sep 2008 16:53] Konstantin Osipov
Needs to be re-verified against the latest 6.0, which has dtoa.

This bug should be fixed by now. If it hasn't been yet, there is no design issue with fixing it any more.
[29 Sep 2008 17:19] Miguel Solorzano
I couldn't repeat anymore on Windows with 5.0/6.0 server.