Skip to content

REAL values lose precision when fetched #16

Description

@jkalias

Problem

FetchRecordsQuery::GetColumnValue (src/queries.cc) formats floating-point columns via std::to_wstring(sqlite3_column_double(stmt_, col)). std::to_wstring(double) uses %f with a fixed 6 decimal places.

Impact

Reads are lossy:

  • 0.123456789 round-trips back as 0.123457.
  • Large magnitudes and values needing scientific notation are mangled.

Writes are fine — binding uses sqlite3_bind_double with the true value — so the corruption happens only on the read path, through the text round-trip.

Suggested direction

Read doubles directly into the member with sqlite3_column_double (preferred — see the broader hydration redesign), or, if the text representation is kept, format with full round-trip precision (e.g. %.17g) rather than to_wstring. Add a test asserting a high-precision double round-trips exactly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions