1
1
mirror of https://github.com/tweag/nickel.git synced 2024-09-17 14:37:30 +03:00
nickel/cli
Viktor Kleen aff367df7e
Error on serializing very large numbers (#1470)
* Error on serializing very large numbers

Instead of blindly using the nearest `f64` for all Nickel `Number`s when
serializing, with this change we only use nearest rounding when a number
is in the range `[f64::MIN, f64::MAX]`. Otherwise we trigger a newly
introduced serialization error.

This stops the previous, arguably surprising, result that for example
`e400` gets serialized as `1.7976931348623157e308`. While techincally
this is the nearest `f64` to `1e400`, one wouldn't expect serialization
to incur an absolute error of about `1e92`.

Fixes #1457

* Add tests
2023-07-21 12:36:11 +00:00
..
bin Topiary integration as nickel format (#1371) 2023-07-13 10:43:51 +00:00
src Topiary integration as nickel format (#1371) 2023-07-13 10:43:51 +00:00
tests/snapshot Error on serializing very large numbers (#1470) 2023-07-21 12:36:11 +00:00
Cargo.toml Static linking with nickel format (#1455) 2023-07-17 14:06:29 +00:00