about summary refs log tree commit diff
path: root/src/doc/guide-tasks.md
diff options
context:
space:
mode:
authorBrendan Zabarauskas <bjzaba@yahoo.com.au>2014-04-18 13:49:37 +1000
committerBrendan Zabarauskas <bjzaba@yahoo.com.au>2014-04-19 10:44:08 +1000
commitbed70a42ecf0747f924c813b3b375d5fd364ffc3 (patch)
treee11c369051a4cc265995b2657aac14443e697eec /src/doc/guide-tasks.md
parentfe472020347d8eeb727f3a31e9cdc7268bb579f6 (diff)
downloadrust-bed70a42ecf0747f924c813b3b375d5fd364ffc3.tar.gz
rust-bed70a42ecf0747f924c813b3b375d5fd364ffc3.zip
Have floating point functions take their parameters by value.
Make all of the methods in `std::num::Float` take `self` and their other parameters by value.

Some of the `Float` methods took their parameters by value, and others took them by reference. This standardises them to one convention. The `Float` trait is intended for the built in IEEE 754 numbers only so we don't have to worry about the trait serving types of larger sizes.

[breaking-change]
Diffstat (limited to 'src/doc/guide-tasks.md')
-rw-r--r--src/doc/guide-tasks.md4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/doc/guide-tasks.md b/src/doc/guide-tasks.md
index 5dd58ccb61d..f9483fb4d6b 100644
--- a/src/doc/guide-tasks.md
+++ b/src/doc/guide-tasks.md
@@ -306,7 +306,7 @@ be distributed on the available cores.
 fn partial_sum(start: uint) -> f64 {
     let mut local_sum = 0f64;
     for num in range(start*100000, (start+1)*100000) {
-        local_sum += (num as f64 + 1.0).powf(&-2.0);
+        local_sum += (num as f64 + 1.0).powf(-2.0);
     }
     local_sum
 }
@@ -343,7 +343,7 @@ extern crate sync;
 use sync::Arc;
 
 fn pnorm(nums: &[f64], p: uint) -> f64 {
-    nums.iter().fold(0.0, |a,b| a+(*b).powf(&(p as f64)) ).powf(&(1.0 / (p as f64)))
+    nums.iter().fold(0.0, |a, b| a + b.powf(p as f64)).powf(1.0 / (p as f64))
 }
 
 fn main() {