[PATCH] LNT ARM sqlite3

Renato Golin rengolin at systemcall.org
Tue Mar 26 10:26:38 PDT 2013


Hi folks,

Been working on sqlite this week and found a few issues.

First, the results from avg(b) is different on x86_64 and ARM because
"long double" is f128 on the former and f64 on the latter in regards
to vxprintf() function. That alone would warrant more care while
writing code, but it seems that vxprintf() is the best example I've
seen so far on what NOT to do with floating points, big or small.

Since that function has a lot of dependencies, I was forced to
improvise and came up with the "sqlite3.patch" attached. It was then
that I found another bug, in fpcmp.

I was getting the values close enough, so I set FP_TOLERANCE to 1e-8
but fpcmp was printing me errors within 1e+3!! That was no FP bug, and
upon investigation, I found that fpcmp was comparing two different
lines...

Not wanting to go down that route, I prepared the second patch
(sqlite3-results.patch) which simple apply the SQL function
"round(avg(b), 8)" and removed the FP comparison altogether, achieving
the same result without hitting the fpcmp bug.

I know it was cowardice, but I didn't want to fix yet another bug (on
unknown territory) while getting the test-suite green, sorry about
that... :(

So, applying sqlite3-results.patch will make it pass on both x86_64
and ARM, and most likely any other 32-bit and 64-bit machines out
there. Any objections?

cheers,
--renato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqlite3-results.patch
Type: application/octet-stream
Size: 112092 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130326/0187f17a/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sqlite3.patch
Type: application/octet-stream
Size: 1350 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130326/0187f17a/attachment-0001.obj>


More information about the llvm-commits mailing list