diff options
| author | Kevin Cantu <me@kevincantu.org> | 2012-06-02 00:15:29 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2012-06-02 16:38:18 -0700 |
| commit | a7359f5b3b484c17a96d036e9ac7074030b48ad5 (patch) | |
| tree | 8f54a1c377db12683a8a436b840a2bd9b05bfa60 /src/rt/rust_kernel.cpp | |
| parent | 7d0755529e729e2e85c30ad45131cd15eea5f04f (diff) | |
| download | rust-a7359f5b3b484c17a96d036e9ac7074030b48ad5.tar.gz rust-a7359f5b3b484c17a96d036e9ac7074030b48ad5.zip | |
(float) fix some rounding errors when showing as str
This seems to fix issue #1876, and some of the superficial parts of
issue #1375. The #fmt macro and the to_str functions will round,
rather than truncate, floats as strings.
Other issues remain, and I wrote more code here than intended, but the
following should pass now.
```
fn x() {
assert "3.1416" == #fmt["%.4f", 3.14159];
assert "3" == #fmt["%.0f", 3.14159];
assert "99" == #fmt["%.0f", 98.5];
assert "7.0000" == #fmt["%.4f", 6.999999999];
assert "3.141590000" == #fmt["%.9f", 3.14159];
}
```
Diffstat (limited to 'src/rt/rust_kernel.cpp')
0 files changed, 0 insertions, 0 deletions
