[PATCH] fpcmp fix (wrt sqlite3)

Renato Golin renato.golin at linaro.org
Wed Apr 3 11:07:27 PDT 2013


As reported in this bug:

http://llvm.org/bugs/show_bug.cgi?id=15620

fpcmp gets it wrong when comparing floating point numbers.

I found that it happens when comparing numbers with different number of
digits, ex:

257359.326881721
257359.32688172

when fpcmp would compare the number with highest precision with the next
one of the low precision.

The attached patch works around this by rolling back one byte if the
difference is in a space AND the previous one is a number. Since only one
of the numbers can be at the space (the shorter one), I only roll back one
the shorter one.

This patch fixes sqlite3 on ARM and will probably fix on TILE-Gx, too.

Please review.

Thanks,
--renato
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130403/10518619/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fpcmp.diff
Type: application/octet-stream
Size: 748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130403/10518619/attachment.obj>


More information about the llvm-commits mailing list