about summary refs log tree commit diff
path: root/src/libstd/sys/unix/stack_overflow.rs
diff options
context:
space:
mode:
authorBarosl Lee <vcs@barosl.com>2014-11-24 03:14:02 +0900
committerBarosl Lee <vcs@barosl.com>2014-12-08 18:02:53 +0900
commitfec0f16c98ab066ff11be35b5a8bb0d80efa90f1 (patch)
treeb0a0aa80fb1c2a3ad2434c71bef14c54f1889b40 /src/libstd/sys/unix/stack_overflow.rs
parentf102123b659911dbee25bbe518d73d66185bb978 (diff)
downloadrust-fec0f16c98ab066ff11be35b5a8bb0d80efa90f1.tar.gz
rust-fec0f16c98ab066ff11be35b5a8bb0d80efa90f1.zip
libserialize: Always use a decimal point when emitting a float value
JSON doesn't distinguish between integer and float. They are just
numbers. Also, in the current implementation, a fractional number
without the fractional part is encoded without a decimal point.

Thereforce, when the value is decoded, it is first rendered as Json,
either I64 or U64. This reduces type safety, because while the original
intention was to cast the value to float, it can also be casted to
integer.

As a workaround of this problem, this commit makes the encoder always
emit a decimal point even if it is not necessary. If the fractional part
of a float number is zero, ".0" is padded to the end of the result.

[breaking-change]
Diffstat (limited to 'src/libstd/sys/unix/stack_overflow.rs')
0 files changed, 0 insertions, 0 deletions