mysql> select 1 / 2;
+--------+
| 1 / 2  |
+--------+
| 0.5000 |
+--------+
1 row in set (0.00 sec)

What the fuck?  When I divide two integers, I expect a integer back, dammit.  
What's even more awesome is that MySQL will round the result if you try to 
insert the value into an integer column.

mysql> create table foo (bar int);
Query OK, 0 rows affected (0.00 sec)

mysql> insert into foo values(3 / 4);
Query OK, 1 row affected (0.02 sec)

mysql> select * from foo;
+------+
| bar  |
+------+
|    1 |
+------+
1 row in set (0.00 sec)

And by awesome I mean crappy.  Sure, I can use FLOOR() or whatever to get what 
I expect, but I don't think I should have to when most programming languages I 
use (and can think of for that matter) don't do this.

Hatefully yours,
Jeremy

Reply via email to