Does any SQL database actually implement IEEE 754 for floats? MySQL can't represent NaN or Infinity, SQLite can't represent NaN (and has no way to specify Infinity as a literal, but will coerce 9e999), and PG returns true for `'NaN'::float = 'NaN'::float`
-
-
MySQL's behavior here is especially weird. It absolutely implements IEEE 754 under the hood, including NaN not equaling itself. But you cannot insert NaN, Infinity, or -Infinity into a table, nor is there a literal form. So you can only observe this with bind params.
Show this threadThanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
it makes things kind of semantically weird to have identical non-null values which are nonequal, for instance, if NaN != NaN, should two rows both be able to have a NaN PK? i think the reasonable answer is no, but you now have two different notions of "equal"
-
I think you should not be able to have a float pk :)
- 2 more replies
New conversation -
-
-
Meh. Having spent most of my working life using an RDBMS where division by zero gets you NULL, I can't really raise a sweat about it… :)
-
Right, I suspect most folks don't really care. It just seems like such a weird corner to cut.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.