SQLite stores the data however you give it. I'm not aware of any
documentation requiring that 9e999 be considered infinity, nor any
requiring that the command line treat invalid numbers as null. Most
likely, treating NaN as null is simply a way for the command line to
behave reasonably in an otherwise undefined situation.

Practically, 9e999 is beyond the "infinity" limit for doubles on
whatever compiler was used to build the command line. I think this limit
is technically arbitrary, so on some compilers, either now, or in the
future, 9e999 could very possibly NOT be infinity.
std::numeric_limits<double>::max() should be a standard (read "safe")
way of getting the "infinity" value in C++.

In the Visual C++ 2005 compiler, the max double is
1.7976931348623158e+308. I'm not sure that this is constant however, so
don't count on it.

-----Original Message-----
From: sqlite-users-boun...@sqlite.org
[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Michael Chen
Sent: Sunday, October 18, 2009 4:19 PM
To: General Discussion of SQLite Database
Subject: Re: [sqlite] Infinity


 I am looking for the answer too. anybody know it?

On Sat, Oct 17, 2009 at 12:23 AM, Dan Bishop <danbisho...@gmail.com>
wrote:

> I've noticed that I can use IEEE Infinity values in SQLite by writing
> any literal too big for a double.
>
> sqlite> CREATE TABLE foo (x REAL);
> sqlite> INSERT INTO foo VALUES (9e999); -- +Inf
> sqlite> INSERT INTO foo VALUES (-9e999); -- -Inf
> sqlite> INSERT INTO foo VALUES (9e999 / 9e999); -- NaN: gets converted
> to NULL
> sqlite> .null NULL
> sqlite> select * FROM foo;
> Inf
> -Inf
> NULL
> sqlite> SELECT * FROM foo WHERE ABS(x) = 9e999;
> Inf
> -Inf
>
> Is it true on all platforms that 9e999 = Infinity and CAST(9e999 AS
> TEXT) = 'Inf'?  What's the preferred SQL syntax for infinity?
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>



-- 
Best regards,
Michael Chen
Google Voice Phone.: 847-448-0647
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to