SQLite4
Check-in [ee5b8b8d11]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixes to the text of the key encoding definition in key_encoding.txt.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ee5b8b8d1171ea8afa12005082263e83f31704ca
User & Date: drh 2012-04-21 18:55:23
Context
2012-04-21
19:19
Fix an off-by-one problem with encoding real values into index keys. Add a test for sorting numeric values. check-in: 7017d07fea user: dan tags: trunk
18:55
Fixes to the text of the key encoding definition in key_encoding.txt. check-in: ee5b8b8d11 user: drh tags: trunk
17:33
Get some more aggregate queries working. check-in: 7aace3e09f user: dan tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to notes/key_encoding.txt.

90
91
92
93
94
95
96
97



98
99
100
101
102
103
104
...
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
...
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
For all values, we compute a mantissa M and an exponent E.  The mantissa
is a base-100 representation of the value.  The exponent E determines
where to put the decimal point.

Each centimal digit of the mantissa is stored in a byte.  If the
value of the centimal digit is X (hence X>=0 and X<=99) then the
byte value will be 2*X+1 for every byte of the mantissa, except
for the last byte which will be 2*X+0.




If we assume all digits of the mantissa occur to the right of the
decimal point, then the exponent E is the power of one hundred
by which one must multiply the mantissa to recover the original 
value.

Examples:
................................................................................
   Value               Exponent E    Significand M (in hex)
  --------             ----------    ----------------------
    1.0                    1          02
    10.0                   1          14
    99.0                   1          b4
    99.01                  1          b5 02
    99.0001                1          b5 01 02
    100.0                  2          03 00
    100.1                  2          03 02
    100.01                 2          03 01 02
    1234                   2          19 44
    9999                   2          c7 c6
    9999.000001            2          c7 c7 01 01 02
    9999.000009            2          c7 c7 01 01 12
    9999.00001             2          c7 c7 01 01 14
................................................................................
    9999.00009             2          c7 c7 01 01 b4
    9999.000099            2          c7 c7 01 01 c6
    9999.0001              2          c7 c7 01 02
    9999.001               2          c7 c7 01 14
    9999.01                2          c7 c7 02
    9999.1                 2          c7 c7 14
    10000                  3          02
    10001                  3          03 00 02
    12345                  3          03 2f 5a
    123450                 4          19 45 64
    1234.5                 3          19 45 64 
    12.345                 2          19 45 64
    0.123                  0          19 3c
    0.0123                 0          03 2e
    0.00123               -1          19 3c







|
>
>
>







 







|







 







|







90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
...
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
For all values, we compute a mantissa M and an exponent E.  The mantissa
is a base-100 representation of the value.  The exponent E determines
where to put the decimal point.

Each centimal digit of the mantissa is stored in a byte.  If the
value of the centimal digit is X (hence X>=0 and X<=99) then the
byte value will be 2*X+1 for every byte of the mantissa, except
for the last byte which will be 2*X+0.  The mantissa must be the
minimum number of bytes necessary to represent the value; trailing
X==0 digits are omitted.  This means that the mantissa will never
contain a byte with the value 0x00.

If we assume all digits of the mantissa occur to the right of the
decimal point, then the exponent E is the power of one hundred
by which one must multiply the mantissa to recover the original 
value.

Examples:
................................................................................
   Value               Exponent E    Significand M (in hex)
  --------             ----------    ----------------------
    1.0                    1          02
    10.0                   1          14
    99.0                   1          b4
    99.01                  1          b5 02
    99.0001                1          b5 01 02
    100.0                  2          02
    100.1                  2          03 02
    100.01                 2          03 01 02
    1234                   2          19 44
    9999                   2          c7 c6
    9999.000001            2          c7 c7 01 01 02
    9999.000009            2          c7 c7 01 01 12
    9999.00001             2          c7 c7 01 01 14
................................................................................
    9999.00009             2          c7 c7 01 01 b4
    9999.000099            2          c7 c7 01 01 c6
    9999.0001              2          c7 c7 01 02
    9999.001               2          c7 c7 01 14
    9999.01                2          c7 c7 02
    9999.1                 2          c7 c7 14
    10000                  3          02
    10001                  3          03 01 02
    12345                  3          03 2f 5a
    123450                 4          19 45 64
    1234.5                 3          19 45 64 
    12.345                 2          19 45 64
    0.123                  0          19 3c
    0.0123                 0          03 2e
    0.00123               -1          19 3c