SQLite returns NULL when subtracting

Bug #277870 reported by Allan Vidal
This bug report is a duplicate of:  Bug #254228: division error in sqlite 3.5.9-5. Edit Remove
16
This bug affects 3 people
Affects Status Importance Assigned to Milestone
sqlite3 (Ubuntu)
Incomplete
Undecided
Unassigned
Nominated for Intrepid by miraks

Bug Description

Binary package hint: sqlite3

When I execute the following statements in SQLite 3.4.2 on Ubuntu 8.04...

CREATE TABLE Test (rowID INTEGER PRIMARY KEY AUTOINCREMENT, value REAL);
INSERT INTO Test VALUES (NULL, 200);
UPDATE Test SET value = (value - 10.205) WHERE rowID = 1;
SELECT * FROM Test;

...the result is 189.795, as expected.

However, when executing the same statements in SQLite 3.5.9 on Ubuntu 8.10 Beta, the result is NULL.

Revision history for this message
Allan Vidal (alnvdl) wrote :

I also reported this bug directly to the SQLite team:
http://www.sqlite.org/cvstrac/tktview?tn=3414,35

The bug seems to be caused by compiling with the --fast-math option, though I did not try this solution myself.

Revision history for this message
miraks (s-mankowski) wrote :

I also do it:
http://www.sqlite.org/cvstrac/tktview?tn=3465,35

Do you know a work around because it's a blocking point for me ?

Revision history for this message
miraks (s-mankowski) wrote :

It's a major issue because of this also happens when selecting direct values:

  sqlite> select 6.6989+22.912345;

  sqlite> select 6.5989+22.912345;
  29.511245

Crazy ! no ?

WARNING: I think that libsql3-0 is impacted too.

Changed in sqlite3:
status: New → Confirmed
Revision history for this message
Allan Vidal (alnvdl) wrote :

miraks, I think the only workaround is doing the math in the application code, and not in SQLite. That is, if you are using SQLite bindings for a programming language.
However, this is not a good solution...

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Can those affected by this bug please try installing sqlite3 and libsqlite3 from my PPA (https://launchpad.net/~r0lf/+archive) and report if that fixes the problem? In that case, we'd see a duplicate of bug 254228 where you can read more about the background.

Changed in sqlite3:
status: Confirmed → Incomplete
Revision history for this message
Allan Vidal (alnvdl) wrote :

Well, I tested the packages you suggested on Intrepid, and it worked fine. So, I'm marking this bug as a duplicate of bug 254228.

Revision history for this message
Rolf Leggewie (r0lf) wrote :

Thanks, Allan, for giving it a shot and reporting back.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.