as you may remember, some time ago I raised an issue with floating point
accuracy, and how this may affect sqlite.

I now have a concrete example, which actually happened in an
installation, and helps to demonstrate the severity of the issue:

try this code:

create table test(f double);
insert into test values(13.04);
update test set f=f+0.02;
select * from test where f=13.06; -- returns no data

can you imagine how many bugs waiting to happen are out there, because
of code like this ?

I know that there are a number of solutions to this problem, all
involving changing the sql involved. 
however, these are not applicable to people using SQLITE via wrappers
that generate their own UUPDATE code.

what I have been trying to say is that, there is also a neat solution to
the problem, and one that can be implemented easily :

pragma floating_accuracy=0.0000001

setting the threshold for float comparisons to some predictable value.

Am I the only one that sees the problem? if not, please speak up, and
maybe we can get a neat solution!



Reply via email to