Tutorial: Add std::num::sqrt to the example.

We should be using the package std::num::sqrt instead of the sqrt function that was defined to return 0.0
This commit is contained in:
Jag Talon 2014-02-24 08:36:23 -05:00 committed by Alex Crichton
parent 54abbda9b4
commit 7fc7c37763
1 changed files with 1 additions and 1 deletions

View File

@ -1420,8 +1420,8 @@ bad, but often copies are expensive. So wed like to define a function
that takes the points by pointer. We can use references to do this:
~~~
use std::num::sqrt;
# struct Point { x: f64, y: f64 }
# fn sqrt(f: f64) -> f64 { 0.0 }
fn compute_distance(p1: &Point, p2: &Point) -> f64 {
let x_d = p1.x - p2.x;
let y_d = p1.y - p2.y;