about summary refs log tree commit diff
path: root/src/libstd/num/f64.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-06-28 14:05:10 -0700
committerAlex Crichton <alex@alexcrichton.com>2013-06-30 09:19:25 -0700
commitd3155faedee97cb916735573fbf067d6305ee730 (patch)
treec7fe8365b82802cb8c634500f6444896014e0286 /src/libstd/num/f64.rs
parent8fe6fc11de4d6bfbffd8b961f5f1f24a338601d5 (diff)
downloadrust-d3155faedee97cb916735573fbf067d6305ee730.tar.gz
rust-d3155faedee97cb916735573fbf067d6305ee730.zip
Specialize to_str_common for floats/integers in strconv
This allows the integral paths to avoid allocations on the heap

Closes #4424, #4423
Diffstat (limited to 'src/libstd/num/f64.rs')
-rw-r--r--src/libstd/num/f64.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index e13dff1e623..c39c7a3a57d 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -796,8 +796,8 @@ impl Float for f64 {
 ///
 #[inline]
 pub fn to_str(num: f64) -> ~str {
-    let (r, _) = strconv::to_str_common(
-        &num, 10u, true, strconv::SignNeg, strconv::DigAll);
+    let (r, _) = strconv::float_to_str_common(
+        num, 10u, true, strconv::SignNeg, strconv::DigAll);
     r
 }
 
@@ -810,8 +810,8 @@ pub fn to_str(num: f64) -> ~str {
 ///
 #[inline]
 pub fn to_str_hex(num: f64) -> ~str {
-    let (r, _) = strconv::to_str_common(
-        &num, 16u, true, strconv::SignNeg, strconv::DigAll);
+    let (r, _) = strconv::float_to_str_common(
+        num, 16u, true, strconv::SignNeg, strconv::DigAll);
     r
 }
 
@@ -831,8 +831,8 @@ pub fn to_str_hex(num: f64) -> ~str {
 ///
 #[inline]
 pub fn to_str_radix(num: f64, rdx: uint) -> ~str {
-    let (r, special) = strconv::to_str_common(
-        &num, rdx, true, strconv::SignNeg, strconv::DigAll);
+    let (r, special) = strconv::float_to_str_common(
+        num, rdx, true, strconv::SignNeg, strconv::DigAll);
     if special { fail!("number has a special value, \
                       try to_str_radix_special() if those are expected") }
     r
@@ -849,7 +849,7 @@ pub fn to_str_radix(num: f64, rdx: uint) -> ~str {
 ///
 #[inline]
 pub fn to_str_radix_special(num: f64, rdx: uint) -> (~str, bool) {
-    strconv::to_str_common(&num, rdx, true,
+    strconv::float_to_str_common(num, rdx, true,
                            strconv::SignNeg, strconv::DigAll)
 }
 
@@ -864,8 +864,8 @@ pub fn to_str_radix_special(num: f64, rdx: uint) -> (~str, bool) {
 ///
 #[inline]
 pub fn to_str_exact(num: f64, dig: uint) -> ~str {
-    let (r, _) = strconv::to_str_common(
-        &num, 10u, true, strconv::SignNeg, strconv::DigExact(dig));
+    let (r, _) = strconv::float_to_str_common(
+        num, 10u, true, strconv::SignNeg, strconv::DigExact(dig));
     r
 }
 
@@ -880,8 +880,8 @@ pub fn to_str_exact(num: f64, dig: uint) -> ~str {
 ///
 #[inline]
 pub fn to_str_digits(num: f64, dig: uint) -> ~str {
-    let (r, _) = strconv::to_str_common(
-        &num, 10u, true, strconv::SignNeg, strconv::DigMax(dig));
+    let (r, _) = strconv::float_to_str_common(
+        num, 10u, true, strconv::SignNeg, strconv::DigMax(dig));
     r
 }