Skip to content

Commit 7fc7c37

Browse files
Jag Talonalexcrichton
Jag Talon
authored andcommitted
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
1 parent 54abbda commit 7fc7c37

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/doc/tutorial.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1420,8 +1420,8 @@ bad, but often copies are expensive. So we’d like to define a function
14201420
that takes the points by pointer. We can use references to do this:
14211421
14221422
~~~
1423+
use std::num::sqrt;
14231424
# struct Point { x: f64, y: f64 }
1424-
# fn sqrt(f: f64) -> f64 { 0.0 }
14251425
fn compute_distance(p1: &Point, p2: &Point) -> f64 {
14261426
let x_d = p1.x - p2.x;
14271427
let y_d = p1.y - p2.y;

0 commit comments

Comments
 (0)