-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Description
invoice_lines.price
is stored as a float.
Traditionally, integers with a magnitude of up to 24 bits are exactly representable (<= 16,777,216). So theoretically, a value like 11,111.11 is representable to within half a cent (and should render correctly). Instead, when we create an invoice with a single line we observe the following:
- $11,111.11 -> $11,111.10
- $111,111.1 -> $111,111.0
- $1,111,111 -> $1,111,110
This is because rather than directly output the stored float value, MySQL rounds it to 6 decimal sigfigs. https://bugs.mysql.com/bug.php?id=87794
Since it is still stored exact, casting to another type will change any past invoices. Past lines need to be rounded to 6 sigfigs at rest to maintain records.
Metadata
Metadata
Assignees
Labels
No labels