Dear Simon,

> A similar thing happens when you specify that a column has affinity of REAL.  
> In both cases, SQLite considers that the CREATE command knows better than 
> whatever specifies the value, and does the conversion.  However for the 
> number to be stored the conversion has to be reversible.  If SQLite reverses 
> the conversion and doesn't get the original string back it stores the string 
> instead.

I don't think this is actually the case:

create table test (i integer, r real, s text);
insert into test (i, r, s) values (3.141592653589793238462643, 
3.141592653589793238462643, 3.141592653589793238462643);
insert into test (i, r, s) values ('3.141592653589793238462643', 
'3.141592653589793238462643', '3.141592653589793238462643');
select * from test;

In any case except of actually storing the string to column s, I get the stored 
value truncated to 14 decimals.

select cast(s as text) from test;

Even here, the first value is truncated to 14 decimals. Only the 2nd is correct.

Kind regards,

sqlite-users mailing list

Reply via email to