On 25 Mar 2012, at 3:48am, "Jay A. Kreibich" <j...@kreibi.ch> wrote:
> On Sat, Mar 24, 2012 at 07:32:32AM -0400, Richard Hipp scratched on the wall: > >> SQLite converts NaN inputs into NULL. > > I think this is the right choice. It is what I would expect. But it's not what the docs say: <http://sqlite.org/datatype3.html> "REAL. The value is a floating point value, stored as an 8-byte IEEE floating point number." That includes +infinity, -infinity, and NaN. If you boast IEEE you should be storing those. Can those values be passed from a 'double' C variable ? I believe so. So I see no reason why SQLite shouldn't be storing them. And given that SQLite does calculations internally you also have to get the correct IEEE-specified results if someone does SELECT a * b FROM myTable or such things. SQLite should return the right result. > [snip] Should SQLite really have to know that much about IEEE 754? A legitimate question. If you removed the reference to IEEE from the documentation, I'd also be satisfied. Presumably SQLite would then generate some sort of error if you passed sqlite3_bind_double() infinite or NaN values since it can stand up to the word REAL without handling them. But saying that you store IEEE and somewhere between accepting and returning it arbitrarily replacing NaN with NULL strikes me as wrong. SQLite3 works the way it does, and changing that is going to break stuff, as people have noted. But I think that a fault has been identified, and SQLite4 (should it ever materialise) should do this better. In the mean time, removing IEEE from the docs might be an idea. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users