Bug #11533 CEIL() RESULT ERROR
Submitted: 23 Jun 2005 18:18 Modified: 24 Jun 2005 7:19
Reporter: greivin rodriguez Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.XX OS:Windows (Windows, Linux, SUSE ES9)
Assigned to: CPU Architecture:Any

[23 Jun 2005 18:18] greivin rodriguez
Description:
FUNCTION CEIL() WRONG RESULT, WRONG CALCULATIONS WHEN USE 2 DECIMALS OR MORE IN THE EXPRESION CALCULATION.

IN MYSQL 5.0.6 WINDOWS, THIS ERROR IS NOT PRESENT

How to repeat:
CASE #1
1 - SELECT CEIL(100) == 100 (OK)
2 - SELECT CEIL(10*10) == 100 (OK)
3 - SELECT CEIL(1*100) == 100 (OK)
4 - SELECT CEIL(.1*1000) == 101 (WRONG)

CASE #2
1 - SELECT CEIL(112 ) == 112 (OK)
2 - SELECT CEIL(11.2 * 10) == 112 (OK)
3 - SELECT CEIL(1.12 * 100) == 113 (WRONG)

Suggested fix:
N/A
[24 Jun 2005 7:19] MySQL Verification Team
Hello Greivin,

I set this bug report to not a bug, because this report shows known behavior of MySQL with floating-point operations.
This behavior is described in the following section of the manual:
http://dev.mysql.com/doc/mysql/en/problems-with-float.html

Since version 5.0.3 there were introduced precision math, that is why you get correct results in 5.0. You can read more about precision math here:
http://dev.mysql.com/doc/mysql/en/precision-math.html