<div dir="ltr">Hi Renato,<div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Mar 26, 2013 at 10:26 AM, Renato Golin <span dir="ltr"><<a href="mailto:rengolin@systemcall.org" target="_blank">rengolin@systemcall.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi folks,<br>
<br>
Been working on sqlite this week and found a few issues.<br>
<br>
First, the results from avg(b) is different on x86_64 and ARM because<br>
"long double" is f128 on the former and f64 on the latter in regards<br>
to vxprintf() function. That alone would warrant more care while<br>
writing code, but it seems that vxprintf() is the best example I've<br>
seen so far on what NOT to do with floating points, big or small.<br>
<br>
Since that function has a lot of dependencies, I was forced to<br>
improvise and came up with the "sqlite3.patch" attached. It was then<br>
that I found another bug, in fpcmp.<br>
<br>
I was getting the values close enough, so I set FP_TOLERANCE to 1e-8<br>
but fpcmp was printing me errors within 1e+3!! That was no FP bug, and<br>
upon investigation, I found that fpcmp was comparing two different<br>
lines...<br>
<br>
Not wanting to go down that route, I prepared the second patch<br>
(sqlite3-results.patch) which simple apply the SQL function<br>
"round(avg(b), 8)" and removed the FP comparison altogether, achieving<br>
the same result without hitting the fpcmp bug.<br>
<br>
I know it was cowardice, but I didn't want to fix yet another bug (on<br>
unknown territory) while getting the test-suite green, sorry about<br>
that... :(<br></blockquote><div><br></div><div style>I'm fine with this form of cowardice, as long as the changes can be reasonably expected to not hide a potential correctness bug (and sqlite is not a benchmark I anticipate to be the one to expose FP math errors). I made a large number of these changes to try and stabilize the output of benchmarks as part of moving to using reference outputs.</div>
<div style><br></div><div style>Please still file the bug with the fpcmp utility, with the two inputs that show the problem.</div><div style><br></div><div style>One thing I do find a little odd is that all of the tests in the test suite pass on ARM on iOS, so I'm a little curious what platform/architecture difference causes you to see this. Any ideas?</div>
<div style><br></div><div style> - Daniel</div><div style><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
So, applying sqlite3-results.patch will make it pass on both x86_64<br>
and ARM, and most likely any other 32-bit and 64-bit machines out<br>
there. Any objections?<br>
<br>
cheers,<br>
--renato<br>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div></div>