Hi everyone,

I was surprised by how the ROUND function handles "Inf" REAL values.

A REAL infinity value can be created by using an overly-large number:

SELECT 1e5000; -- Inf

When casting infinity to an integer value, the largest integer is returned,
which seems intuitive to me:

SELECT CAST(1e5000 AS INT); -- 9223372036854775807 (2^63 - 1)

However, the ROUND function always converts Inf to zero, which is somehow
surprising, since a >= b does not imply ROUND(a) >= ROUND(b) (which
contrasts the behavior of a cast):

SELECT 1e500 >= 1,  CAST(1e500 AS INT) >= CAST(1 AS INT), ROUND(1e500) >=
ROUND(1); -- 1|1|0

Is this deliberate? Would it make sense to let ROUND(Inf) = Inf (and
ROUND(-Inf) = -Inf))?

Best,
Manuel
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to