Hi Michael,
thank you for response.
So only solution is use TEXT columns (with TEXT affinity) ? There is no
way how to use DECIMAL columns (with NUMERIC affinity) ?
My goal is store numeric values with big precision (as declared per
column DECIMAL(30,7)).
I do not want any conversion to floating-point values ... because such
conversion loses digits and is not reversible to original value.
What I will expect is: If supplied value can not be "reversibly"
converted to floating-point representation (REAL storage class), then
store it as text with TEXT storage class ... but this does not happen
(SQLite converts to floating-point and stores it and looses digits).
But on this page http://www.sqlite.org/datatype3.html is written:
"When text data is inserted into a NUMERIC column, the storage class of
the text is converted to INTEGER or REAL (in order of preference) if
such conversion is lossless and reversible. For conversions between TEXT
and REAL storage classes, SQLite considers the conversion to be lossless
and reversible if the first 15 significant decimal digits of the number
are preserved. *If the lossless conversion of TEXT to INTEGER or REAL is
not possible then the value is stored using the TEXT storage class*."
Laco.
Hi,
I have table like this:
CREATE TABLE tab1 (
a INTEGER,
c DECIMAL(30,7),
...
);
When I am trying insert values like:
INSERT INTO tab1 (a,c) VALUES(1, 123456789123456789.123456);
INSERT INTO tab1 (a,c) VALUES(2, '123456789123456789.123456');
values for c column are always rounded or cast to :
1.23456789012346e+19
If I understand correctly column c has NUMERIC affinity, but when
storing values, they are stored using REAL storage class.
But why, when conversion from TEXT is NOT lossless ? (AFAIU first 15
significant digits are not preserved)
Is there way how to store numeric values, which are out of REAL range ?
TIA
-Laco.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users