Bug #11114 wrong rounding in FORMAT() on Windows (test 'func_math' fails)
Submitted: 6 Jun 2005 13:07 Modified: 6 Jun 2005 21:48
Reporter: Carsten Segieth Email Updates:
Status: Duplicate Impact on me:
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.6-beta OS:Windows (Windows XP Home SP2)
Assigned to: CPU Architecture:Any

[6 Jun 2005 13:07] Carsten Segieth
'perl mysql-test-run.pl func_math' leads to a wrong result on Windows:

select format(4.55, 1), format(4.551, 1);
format(4.55, 1)	format(4.551, 1)
4.5	4.6

where the 1st '4.5' is wrong. It should be (as it seems on Unix?) '4.6'.

How to repeat:
try test case on Windows using the 5.0.6-beta binaries
[6 Jun 2005 16:17] Sergei Golubchik
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the original bug instead.

Thank you for your interest in MySQL.

Additional info:

[6 Jun 2005 21:48] Sergei Golubchik
Just to clarify:

currently FORMAT(X, N) implicitly casts the argument (X) to double. Thus, the rounding rules of the system libc apply, and results become OS- and architecture-dependent.

Fix: FORMAT() should use exact arithmetics when operating with exact numbers.