SQLite Forum

ORDER BY not working for a specific DB/table
Login
Vagaries of the compiler and platform.  For exactly the same code, compiled on the same Windows 10 for Workstations running on the same Xeon processor:

Compiled with MinGW GCC 9.1.0 (x32 and x64 identical):
```
SQLite version 3.32.0 2020-05-21 20:32:25
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table mypar (one, second);
sqlite> insert into mypar VALUES (round(30.1233198123987303101203,1), round(30.817232123312));
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE mypar (one, second);
INSERT INTO mypar VALUES(30.100000000000001421,31.0);
COMMIT;
sqlite> .quit
```

but with Microsoft (R) C/C++ Optimizing Compiler Version 19.25.28614 for x64:
```
SQLite version 3.32.0 2020-05-21 20:32:25
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> create table mypar (one, second);
sqlite> insert into mypar VALUES (round(30.1233198123987303101203,1), round(30.817232123312));
sqlite> .dump
PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE mypar (one, second);
INSERT INTO mypar VALUES(30.100000000000002309,31.000000000000000888);
COMMIT;
sqlite>
```

and for the current 3.8.2 Python for Windows:
```
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import *
>>> '%.18f' % round(30.1233198123987303101203,1)
'30.100000000000001421'
>>> '%.18f' % round(30.817232123312)
'31.000000000000000000'
>>>
```