On Thu, 7 Mar 2013 18:45:23 +0000
Simon Slavin <slav...@bigfraud.org> wrote:

> what do you think the desired behaviour would be for
> 
> CAST('0.999999999' AS INTEGER)
> 
> I know what I want.  Perhaps this can be fixed in SQLite4.  

Sorry, but CAST is not a math function.  There's probably a language
somewhere out there that rounds floating point when assigned to
integer, but every language I've ever used that supported those types
truncated the fractional portion.  It's also what the SQL standard
specifies.  

Consider, do you want 

        CAST(0.5 as integer)

to be 1?  What about 0.49?  What about 0.4999999?  

These issues are why round() exists.  

--jkl
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to