diff options
| author | Barosl Lee <vcs@barosl.com> | 2014-11-24 02:22:30 +0900 |
|---|---|---|
| committer | Barosl Lee <vcs@barosl.com> | 2014-12-08 18:02:12 +0900 |
| commit | ca4f53655e82a0a0e1d613b16108720bb7a50fde (patch) | |
| tree | 72d36b4ee75e4676c5610c0b1b8c6024f7b82746 /src/libstd/sys/unix/stack_overflow.rs | |
| parent | 83a44c7fa676b4e5e546ce3d4624e585f9a1e899 (diff) | |
| download | rust-ca4f53655e82a0a0e1d613b16108720bb7a50fde.tar.gz rust-ca4f53655e82a0a0e1d613b16108720bb7a50fde.zip | |
libserialize: Remove float preprocessing in serialize::json::Encoder
serialize::json::Encoder currently uses f64 to emit any integral type. This is possibly due to the behavior of JavaScript, which uses f64 to represent any numeric value. This leads to a problem that only the integers in the range of [-2^53+1, 2^53-1] can be encoded. Therefore, i64 and u64 cannot be used reliably in the current implementation. RFC 7159 suggests that good interoperability can be achieved if the range is respected by implementations. However, it also says that implementations are allowed to set the range of number accepted. And it seems that the JSON encoders outside of the JavaScript world usually make use of i64 values. This commit removes the float preprocessing done in the emit_* methods. It also increases performance, because transforming f64 into String costs more than that of an integral type. Fixes #18319 [breaking-change]
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions
