On 7 Mar 2013, at 6:27pm, Ryan Johnson <ryan.john...@cs.utoronto.ca> wrote:

> The problem is sqlite3 doesn't cast to REAL first. It just parses the string 
> until it hits '.' (which isn't a valid part of an integer) and then returns 
> whatever it had accumulated so far. That breaks in creative ways for values 
> like:
> 
> cast('10e-1' as integer) -- 10
> cast('abc' as integer) -- 0

Ah, thank you.  Good explanation.

I consider this behaviour wrong, too.  Casting a string as INTEGER should take 
into account what it means as a REAL.  For instance, as a 
programmer/statistician, 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.

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

Reply via email to