SQLite

View Ticket
Login
Ticket Hash: 1248e6cda84b96e06819df267a3059ae46ddedcf
Title: Insufficient precision of sqlite3_column_text16() for floating point values
Status: Closed Type: Code_Defect
Severity: Important Priority: Immediate
Subsystem: Unknown Resolution: Rejected
Last Modified: 2014-03-11 12:54:58
Version Found In: 3.5.9
Description:
sqlite3_column:text16() rounds floating point values with more than 15 decimal digits after the decimal point to 15 decimal digits after the decimal point.

Here is the relevant code from "sqlite3VdbeMemStringify" which is called by "sqlite3_column_text16":

}else{ assert( fg & MEM_Real ); sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->r); }

The precision of 15 is insufficient and should be 17 instead (see http://speleotrove.com/decimal/decifaq6.html#binapprox), otherwise what you store in the database is not exactly as what you get from the database (rounded to 15 decimal digits after the decimal point) and what you would get by sqlite3_column_double().