Bug #8551 calculation error
Submitted: 16 Feb 2005 16:28 Modified: 16 Feb 2005 17:27
Reporter: Oliver Peters Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1.10 OS:Windows (Windows2000)
Assigned to: CPU Architecture:Any

[16 Feb 2005 16:28] Oliver Peters
Description:
IF this result is correct:

SELECT 2.1/0.3;

-> 7

this can't be:

SELECT IF((2.1/0.3)>7,1,0);

-> 1

How to repeat:
do the described queries
[16 Feb 2005 17:27] Jorge del Conde
Hi!

mysql> SELECT IF(round(2.1/0.3)>7,1,0);
+--------------------------+
| IF(round(2.1/0.3)>7,1,0) |
+--------------------------+
|                        0 |
+--------------------------+
1 row in set (0.00 sec)

mysql> 

Without the round() function, you get 1 because the result is a real number.