This repository was archived by the owner on Dec 25, 2019. It is now read-only.
Commit b5621c0
committed
Don't lose precision when parsing decimal fractions
The SQL standard requires that numeric literals with a decimal point,
like 1.23, are represented exactly, up to some precision. That means
that parsing these literals into f64s is invalid, as it is impossible
to represent many decimal numbers exactly in binary floating point (for
example, 0.3).
This commit parses all numeric literals into a new `Value` variant
`Number(String)`, removing the old `Long(u64)` and `Double(f64)`
variants. This is slightly less convenient for downstream consumers, but
far more flexible, as numbers that do not fit into a u64 and f64 are now
representable.1 parent 2bef9ec commit b5621c0
5 files changed
Lines changed: 82 additions & 77 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | 13 | | |
15 | 14 | | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
| 18 | + | |
| 19 | + | |
23 | 20 | | |
24 | 21 | | |
25 | 22 | | |
| |||
60 | 57 | | |
61 | 58 | | |
62 | 59 | | |
63 | | - | |
64 | | - | |
| 60 | + | |
65 | 61 | | |
66 | 62 | | |
67 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1183 | 1183 | | |
1184 | 1184 | | |
1185 | 1185 | | |
1186 | | - | |
1187 | | - | |
1188 | | - | |
1189 | | - | |
1190 | | - | |
1191 | | - | |
1192 | | - | |
1193 | | - | |
| 1186 | + | |
1194 | 1187 | | |
1195 | 1188 | | |
1196 | 1189 | | |
| |||
1864 | 1857 | | |
1865 | 1858 | | |
1866 | 1859 | | |
1867 | | - | |
| 1860 | + | |
1868 | 1861 | | |
1869 | 1862 | | |
1870 | 1863 | | |
1871 | 1864 | | |
1872 | 1865 | | |
1873 | 1866 | | |
1874 | 1867 | | |
1875 | | - | |
| 1868 | + | |
1876 | 1869 | | |
1877 | 1870 | | |
1878 | 1871 | | |
| |||
0 commit comments