Commit 6e9b9fc
Paddy Carver
Make all Numbers *big.Floats by default.
When handling types that came from JSON or msgpack, anything that's
supposed to be a number we try to coerce into being a *big.Float, which
is the only lossless type we can standardise all Numbers on. This
prevents developers from needing to worry about getting Numbers in
different intermediary types based on what value was provided. Unmarshal
will give developers the type in whatever convenient format they ask
for, but will always throw an error in the face of a loss of specificity
(except for float32/float64, in which case it's impossible to know if
accuracy was lost).1 parent 422b678 commit 6e9b9fc
1 file changed
+34
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | | - | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
345 | 370 | | |
346 | 371 | | |
347 | 372 | | |
| |||
0 commit comments