about summary refs log tree commit diff
path: root/library/alloc
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2020-10-31 13:16:14 -0700
committerJubilee Young <workingjubilee@gmail.com>2021-03-22 17:02:09 -0700
commit74db93ed2d0677bbca8ba85617f05eae745363d8 (patch)
tree75be2048eef663446a8c6b32264c4a59c9e9f1d2 /library/alloc
parent588cc644ad6d6d6419dcd48651ae451557cdc100 (diff)
downloadrust-74db93ed2d0677bbca8ba85617f05eae745363d8.tar.gz
rust-74db93ed2d0677bbca8ba85617f05eae745363d8.zip
Preserve signed zero on roundtrip
This commit removes the previous mechanism of differentiating
between "Debug" and "Display" formattings for the sign of -0 so as
to comply with the IEEE 754 standard's requirements on external
character sequences preserving various attributes of a floating
point representation.

In addition, numerous tests are fixed.
Diffstat (limited to 'library/alloc')
-rw-r--r--library/alloc/tests/fmt.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/library/alloc/tests/fmt.rs b/library/alloc/tests/fmt.rs
index 757fddd2418..ade3bc2d334 100644
--- a/library/alloc/tests/fmt.rs
+++ b/library/alloc/tests/fmt.rs
@@ -154,8 +154,7 @@ fn test_format_macro_interface() {
     t!(format!("{:+10.3e}", -1.2345e6f64), "  -1.234e6");
 
     // Float edge cases
-    t!(format!("{}", -0.0), "0");
-    t!(format!("{:?}", -0.0), "-0.0");
+    t!(format!("{}", -0.0), "-0");
     t!(format!("{:?}", 0.0), "0.0");
 
     // sign aware zero padding