summary refs log tree commit diff
path: root/src/libcore/num
diff options
context:
space:
mode:
authorMarvin Löbel <loebel.marvin@gmail.com>2013-02-02 16:40:42 +0100
committerBrian Anderson <banderson@mozilla.com>2013-02-03 15:37:25 -0800
commitaf4972f3ce2235ee3055b281f381214529f4e4ef (patch)
treea2d0a963e483d20202fab9f7dcdb56cfb6d67352 /src/libcore/num
parent98445d95d4615093c5e639f1e966830b99b95d63 (diff)
downloadrust-af4972f3ce2235ee3055b281f381214529f4e4ef.tar.gz
rust-af4972f3ce2235ee3055b281f381214529f4e4ef.zip
Fixed `fmt!`, tests, doc-tests.
Diffstat (limited to 'src/libcore/num')
-rw-r--r--src/libcore/num/num.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcore/num/num.rs b/src/libcore/num/num.rs
index 9a138de3cf3..30f6a727f0a 100644
--- a/src/libcore/num/num.rs
+++ b/src/libcore/num/num.rs
@@ -422,6 +422,12 @@ pub pure fn to_str_bytes_common<T: Num Zero One Eq Ord Round Copy>(
                 buf = buf.slice(0, i + 1);
             }
         }
+    } // If exact and trailing '.', just cut that
+    else {
+        let max_i = buf.len() - 1;
+        if buf[max_i] == '.' as u8 {
+            buf = buf.slice(0, max_i);
+        }
     }
 
     (buf, false)
@@ -678,4 +684,4 @@ pub pure fn from_str_common<T: Num Zero One Ord Copy>(
         ) -> Option<T> {
     from_str_bytes_common(str::to_bytes(buf), radix, negative,
                             fractional, special, exponent, empty_zero)
-}
\ No newline at end of file
+}