SQLite

View Ticket
Login
Ticket Hash: 1ec41379c9c1e400e0d0d2c1d8f8731c2cbf92f6
Title: Integer multiple fails to overflow to floating-point
Status: Fixed Type: Code_Defect
Severity: Severe Priority: Immediate
Subsystem: Unknown Resolution: Fixed
Last Modified: 2016-09-20 22:04:18
Version Found In:
User Comments:
drh added on 2016-09-20 20:33:39:

If integer arithmetic overflows in SQLite, it is suppose to convert the answer to floating point. But sometimes it returns a large negative number:

SELECT 3037000500*3037000500;

Experiments on SqlFiddle.com show that PostgreSQL, MySQL, and SQL Server all throw integer overflow exceptions for the above. Oracle overflows to floating point.

This problem has been in SQLite since before version 3.5.1 (2007-10-04).

Problem reported on the mailing list by Scott Hess from Google.