Re: [sqlite] SQLite4 key encoding of numbers

2012-07-15 Thread Richard Hipp
On Sun, Jul 15, 2012 at 11:25 AM, Steven E. Harris wrote: > There are a few examples in the "Numeric Encoding" section of the > Wiki page titled "SQLite4: Key Encoding"¹ that I don't understand. > Are these examples wrong on the Wiki page, or am I misunderstanding the > encoding

Re: [sqlite] record number after reordering

2012-07-15 Thread Igor Tandetnik
Luis Mochan wrote: > I want to reorder a table and then group and average it's values. I > tried something similar to > > SELECT AVG(a) FROM (SELECT a FROM table ORDER BY a) group by ROWID/10; > > in order to take the average 'a' for groups of 10 succesive values. Something

Re: [sqlite] Floating point numbers

2012-07-15 Thread Steven E. Harris
Klaas Van Be writes: > More about this: > http://en.wikipedia.org/wiki/IEEE_floating_point Thanks, but the question doesn't have anything to do with the IEEE 754 representation, with which I'm familiar enough. The question here concerns SQLite's new numeric value encoding used in keys, which

[sqlite] Floating point numbers

2012-07-15 Thread Klaas Van Be
Steven E. Harris  wrote: Another one I can't figure out: Value    Exponent E    Significand M (in hex) =   =   == 100.1    2                    03 02 I expect that this should have the digits 01, 00, and 10, yielding:   2 * 01 + 1 = 3  = 0x03   2 * 00 + 1

Re: [sqlite] record number after reordering

2012-07-15 Thread Luis Mochan
Thanks Keith! Creating a temporal table with it's own rowid solved the problem. Luis On Sun, Jul 15, 2012 at 10:48:32AM -0600, Keith Medcalf wrote: > How about: > > drop table if exists temp.ordered; > create temporary table ordered (a number not null); > insert into ordered select a from table

Re: [sqlite] record number after reordering

2012-07-15 Thread Keith Medcalf
How about: drop table if exists temp.ordered; create temporary table ordered (a number not null); insert into ordered select a from table order by a; select avg(a) from ordered group by rowid/100; drop table if exists temp.ordered; --- () ascii ribbon campaign against html e-mail /\

[sqlite] record number after reordering

2012-07-15 Thread Luis Mochan
I want to reorder a table and then group and average it's values. I tried something similar to SELECT AVG(a) FROM (SELECT a FROM table ORDER BY a) group by ROWID/10; in order to take the average 'a' for groups of 10 succesive values. My example fails. To understand I tried SELECT ROWID FROM

[sqlite] SQLite4 key encoding of numbers

2012-07-15 Thread Steven E. Harris
There are a few examples in the "Numeric Encoding" section of the Wiki page titled "SQLite4: Key Encoding"¹ that I don't understand. I think the table entries may be erroneous. By working through the examples here, I hope to either correct my misunderstading or to get the Wiki page corrected.