[sqlite] Rounding Error ,,, Last Patch was incorrect (Sorry)

2012-06-16 Thread Keith Medcalf
That last patch was a bad workaround -- please ignore it. The et_getdigit function does count the number of significant digits returned. However, it has a wrong boundary. Limiting the number of significant digits is more correct than changing the output precision. So, the following changes

Re: [sqlite] VERY weird rounding error

2012-06-16 Thread Keith Medcalf
> Ideally, you write your software so that differences in the 15th decimal > place don't matter to you. If you want two platforms to give identical > results you use integer arithmetic. It really depends on what kind of > application you're writing (scientific, financial) or what your numbers >

Re: [sqlite] VERY weird rounding error

2012-06-16 Thread Simon Slavin
On 17 Jun 2012, at 12:06am, Etienne wrote: > Is there a trick (in the sys. libraries mentioned above, or through the win32 > C API) for changing the way the FPU handles (long) doubles? You're at tricky low level detail now. Rounding and truncation modes used by chips which implement IEEE754

[sqlite] VERY weird rounding error

2012-06-16 Thread Etienne
If ever I forget later, I would like to thank you guys (esp. Simon, Dominique, Keith and Jay) for the time you spend on this issue. Your idea of dumping the memory at &realvalue was a very good idea, Simon. You were right: "realvalue" values are already slightly different (2 less significant by

[sqlite] Patch Precision Specifier: (was: VERY weird rounding error)

2012-06-16 Thread Keith Medcalf
Format specifiers are forcing 15 digits of precision, so the default precision of 6 is being ignored. Here is a patch that fixes the code in the amalgamation so the default precision of 6 will be used for floating point to text operations. I don't know if both need to be patched, but this is

Re: [sqlite] VERY weird rounding error

2012-06-16 Thread Jay A. Kreibich
On Sat, Jun 16, 2012 at 02:00:27PM -0600, Keith Medcalf scratched on the wall: > > Found the problem. > > At sqlite3.c 19883: > if( precision<0 ) precision = 6; /* Set default precision */ > > precision has a value of 15. It should be 14 or less. Don't know > where it is getting this va

Re: [sqlite] VERY weird rounding error

2012-06-16 Thread Keith Medcalf
Found the problem. At sqlite3.c 19883 if( precision<0 ) precision = 6; /* Set default precision */ precision has a value of 15. It should be 14 or less. Don't know where it is getting this value from however. --- () ascii ribbon campaign against html e-mail /\ www.asciiribbon.or

Re: [sqlite] VERY weird rounding error

2012-06-16 Thread Keith Medcalf
Are you using the "same machine code" or merely "the same source code"? The sqlite3 shell.c always asks for the results back converted to text. Does your "other" shell ask for the results as "text" or as a double? ...>python Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Inte

Re: [sqlite] VERY weird rounding error

2012-06-16 Thread Simon Slavin
On 16 Jun 2012, at 6:32pm, Etienne wrote: > Once again, I really do not care of the accuracy. > > I KNOW 0.1 CAN NOT BE STORED EXACTLY IN A REAL VARIABLE. I am unsurprised to find that your decimal strings are different after the 11th decimal place because your REAL values are not stored to 1

Re: [sqlite] VERY weird rounding error

2012-06-16 Thread Dominique Pellé
Etienne wrote: > Hi Simon, > > Once again, I really do not care of the accuracy. > > I KNOW 0.1 CAN NOT BE STORED EXACTLY IN A REAL VARIABLE. > > I just try to figure out why the SAME CODE (sqlite3 library) with the SAME > INPUT gives DIFFERENT RESULTS (no matter how accurate/exact they individu

[sqlite] VERY weird rounding error

2012-06-16 Thread Etienne
Hi Simon, Once again, I really do not care of the accuracy. I KNOW 0.1 CAN NOT BE STORED EXACTLY IN A REAL VARIABLE. I just try to figure out why the SAME CODE (sqlite3 library) with the SAME INPUT gives DIFFERENT RESULTS (no matter how accurate/exact they individually are!) when linked to dif

Re: [sqlite] VERY weird rounding error: details

2012-06-16 Thread Simon Slavin
On 16 Jun 2012, at 5:41pm, Etienne wrote: > 19913: realvalue *= 0.1; This operation cannot be correctly executed while holding the value in a real variable. You will get inconsistent results. Please read the reference I gave earlier for an explanation of why it is pointless trying to get

Re: [sqlite] error group_concat

2012-06-16 Thread Kees Nuyt
On Sat, 16 Jun 2012 15:13:49 +, "Black, Michael (IS)" wrote: > >On my Windows 3.7.12 version it gets a segfault. >On my Unix 3.7.13 version I get the misuse of aggregate SunOS ozon 5.11 snv_130 i86pc i386 i86pc 3.7.12 2012-03-31 19:12:23 af602d87736b52802a4e760ffeeaa28112b99d9a stil

[sqlite] VERY weird rounding error: details

2012-06-16 Thread Etienne
Hi all, The "0.1 case" is still a mystery! For clarity reasons, I have expanded line 19911 of sqlite3.c (v3.7.13) 19909: while( realvalue>=1e32 && exp<=350 ){ realvalue *= 1e-32; exp+=32; } 19910: while( realvalue>=1e8 && exp<=350 ){ realvalue *= 1e-8; exp+=8; } 19911: while( realvalue>=10.

Re: [sqlite] error group_concat

2012-06-16 Thread Luuk
On 16-06-2012 17:13, Black, Michael (IS) wrote: > Works in 3.7.9 > > > On my Windows 3.7.12 version it gets a segfault. > On my Unix 3.7.13 version I get the misuse of aggregate > > works in 3.7.11 too (Windows7): SQLite version 3.7.11 2012-03-20 11:35:50 Enter ".help" for instructions Enter

Re: [sqlite] Strange behavior with fts4

2012-06-16 Thread Yuriy Kaminskiy
Philip Bennefall wrote: > I hate to be cluttering up the list in this fashion, but I have come across > an issue that I cannot seem to find a solution for. > > I am using two fts tables, one that uses the normal tokenizer and another > that uses the porter stemmer, so that I can search the same

Re: [sqlite] error group_concat

2012-06-16 Thread Black, Michael (IS)
Works in 3.7.9 SQLite version 3.7.9 2011-11-01 00:52:41 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT NULL,A4 INTEGER NOT NULL,PRIMARY KEY(A1)); sqlite> REPLACE INTO t1 VALUES(1,11,111,

Re: [sqlite] error group_concat

2012-06-16 Thread Igor Tandetnik
Luigi wrote: > CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT > NULL,A4 INTEGER NOT NULL,PRIMARY KEY(A1)); > REPLACE INTO t1 VALUES(1,11,111,); > REPLACE INTO t1 VALUES(2,22,222,); > REPLACE INTO t1 VALUES(3,33,333,); > CREATE TABLE t2 (B1 INTEGER NOT NULL,B2 I

[sqlite] error group_concat

2012-06-16 Thread Luigi
CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT NULL,A4 INTEGER NOT NULL,PRIMARY KEY(A1)); REPLACE INTO t1 VALUES(1,11,111,); REPLACE INTO t1 VALUES(2,22,222,); REPLACE INTO t1 VALUES(3,33,333,); CREATE TABLE t2 (B1 INTEGER NOT NULL,B2 INTEGER NOT NULL,B3 INTEGE

[sqlite] error group_concat

2012-06-16 Thread Luigi
CREATE TABLE t1 (A1 INTEGER NOT NULL,A2 INTEGER NOT NULL,A3 INTEGER NOT NULL,A4 INTEGER NOT NULL,PRIMARY KEY(A1)); REPLACE INTO t1 VALUES(1,11,111,); REPLACE INTO t1 VALUES(2,22,222,); REPLACE INTO t1 VALUES(3,33,333,); CREATE TABLE t2 (B1 INTEGER NOT NULL,B2 INTEGER NOT NULL,B3 INTEGE

[sqlite] Strange behavior with fts4

2012-06-16 Thread Philip Bennefall
I hate to be cluttering up the list in this fashion, but I have come across an issue that I cannot seem to find a solution for. I am using two fts tables, one that uses the normal tokenizer and another that uses the porter stemmer, so that I can search the same dataset with and without porter.

Re: [sqlite] read sql file in c++

2012-06-16 Thread Stephan Beal
On Sat, Jun 16, 2012 at 4:32 AM, Simon Slavin wrote: > There is no way to do it in one command. You can write your own C++ code > to read the text file one line at a time and call sqlite3_exec() for that > line. There is an example of a C++ program which calls that function here: > be careful