First I attempted to just call sqrt, even though i didn't expect it to work.

Then I found out that there's a std::num::sqrt function at http://static.rust-lang.org/doc/0.10/st ... .sqrt.html, so I attempted to import it

Code: Select all

`use std::num::sqrt;`

fn my_square_root(n:int) -> int {

std::num::sqrt(n)

}

This complains saying that unresolved import: there is no `sqrt` in `std::num`.

So i thought that I might not be importing it right ('import math.sqrt' vs 'from math import sqrt' in Python).

Next attempt was importing std::num and calling std::num::sqrt. This makes the 'use std::num;' line correct, but breaks at the call with the error unresolved name `std::num::sqrt`.

Then i found this StackOverflow post: http://stackoverflow.com/questions/1793 ... -in-stdnum whose error looks suspiciously like mine. So i went and tried:

Code: Select all

`use std::float;`

fn my_square_root(n:int) -> float {

(n as float).sqrt()

}

but apparently there is no `float` in `std`. I can't use float in my code either. Was the float type removed?

I noticed there are a lot of incompatible versions. I'm using 0.11.0 nightly downloaded from http://www.rust-lang.org/

Any help will be appreciated!