Skip to content

Instantly share code, notes, and snippets.

@ROki1988
Created June 20, 2016 13:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ROki1988/398128bb68bd659a975ab0ba48bbb418 to your computer and use it in GitHub Desktop.
Save ROki1988/398128bb68bd659a975ab0ba48bbb418 to your computer and use it in GitHub Desktop.
Rust sqrt
fn main() {
let sqrts = (2..100).map(|x| f64::from(x).sqrt());
for num in sqrts.into_iter() {
println!("{}", num);
}
}
Running `target/debug/a_12`
1.4142135623730951
1.7320508075688772
2
2.23606797749979
2.449489742783178
2.6457513110645907
2.8284271247461903
3
3.1622776601683795
3.3166247903554
3.4641016151377544
3.605551275463989
3.7416573867739413
3.872983346207417
4
4.123105625617661
4.242640687119285
4.358898943540674
4.47213595499958
4.58257569495584
4.69041575982343
4.795831523312719
4.898979485566356
5
5.0990195135927845
5.196152422706632
5.291502622129181
5.385164807134504
5.477225575051661
5.5677643628300215
5.656854249492381
5.744562646538029
5.830951894845301
5.916079783099616
6
6.082762530298219
6.164414002968976
6.244997998398398
6.324555320336759
6.4031242374328485
6.48074069840786
6.557438524302
6.6332495807108
6.708203932499369
6.782329983125268
6.855654600401044
6.928203230275509
7
7.0710678118654755
7.14142842854285
7.211102550927978
7.280109889280518
7.3484692283495345
7.416198487095663
7.483314773547883
7.54983443527075
7.615773105863909
7.681145747868608
7.745966692414834
7.810249675906654
7.874007874011811
7.937253933193772
8
8.06225774829855
8.12403840463596
8.18535277187245
8.246211251235321
8.306623862918075
8.366600265340756
8.426149773176359
8.48528137423857
8.54400374531753
8.602325267042627
8.660254037844387
8.717797887081348
8.774964387392123
8.831760866327848
8.888194417315589
8.94427190999916
9
9.055385138137417
9.1104335791443
9.16515138991168
9.219544457292887
9.273618495495704
9.327379053088816
9.38083151964686
9.433981132056603
9.486832980505138
9.539392014169456
9.591663046625438
9.643650760992955
9.695359714832659
9.746794344808963
9.797958971132712
9.848857801796104
9.899494936611665
9.9498743710662
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment