Open AnyhowStep opened 4 years ago
SELECT
PI() = 3.14159265358979,
3.14159265358979 = PI(),
PI() = 3.141592653589793,
3.141592653589793 = PI(),
3.14159265358979 = 3.141592653589793,
3.141592653589793 = 3.14159265358979,
PI(),
3.14159265358979,
3.141592653589793,
(PI()+0e0) = 3.14159265358979,
3.14159265358979 = (PI()+0e0),
(PI()+0e0) = 3.141592653589793,
3.141592653589793 = (PI()+0e0)
;
PI() = 3.14159265358979 | 3.14159265358979 = PI() | PI() = 3.141592653589793 | 3.141592653589793 = PI() | 3.14159265358979 = 3.141592653589793 | 3.141592653589793 = 3.14159265358979 | PI() | 3.14159265358979 | 3.141592653589793 | (PI()+0e0) = 3.14159265358979 | 3.14159265358979 = (PI()+0e0) | (PI()+0e0) = 3.141592653589793 | 3.141592653589793 = (PI()+0e0) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | 1 | 1 | 1 | 0 | 0 | 3.141593 | 3.14159265358979 | 3.141592653589793 | 0 | 0 | 1 | 1 |
WHY MYSQL WHY
You know how one of the oft-touted rules for databases is to decouple data and representation? MySQL really ignores that rule for the PI() functions.
https://dev.mysql.com/doc/refman/8.0/en/mathematical-functions.html#function_pi
So,
PI()
is 3.141593, butPI() + 0e0
is 3.141592653589793And,
PI() = 3.141592653589793
isTRUE
because the displayed value and actual value are different.However, database drivers don't generally know about this So, you might think a MySQL driver would return the "actual" value of PI() And not the "display" value of PI() Nope MySQL drivers return the "display" value of PI() !@#$%^&*
This gives weird shit like,
We also have,