From reading discussions of 4chan’s /prog/ boards, it seems that MySQL has some pretty weird behaviors when dividing by zero.
For example:
mysql> SELECT 1/0
will yield NULL, when the majority of other programming languages will have an error, or produce an NaN value (if float).
even two similar statements which both equate to a NULL because of division by zero are NOT equal:
mysql> SELECT NULL = NULL;
yields NULL
mysql> SELECT POW(0,-1) = 1/0;
yields NULL; consistent with MySQL behavior
mysql> SELECT POW(0,-1) <=> 1/0;
yields 0; inconsistent, 0 != NULL
and the weirdest part? take a look at this statement which uses the bitwise AND operator:
mysql> SELECT POW(0,-1) & POW(0,-1);
which would yield:
9223372036854775808
since x & x is equal to x
in short, according to MySQL,
1/0 = 9223372036854775808








Add Comment

