- isqrt
- integer_sqrt
Square root of integer numbers
- There is a method called isqrt, but it is experimental.
- There is a crate called integer-sqrt that provides a trait called IntegerSquareRoot and a method called integer_sqrt.
examples/numbers/sqrt-of-integer/Cargo.toml
[package] name = "sqrt-of-integer" version = "0.1.0" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] integer-sqrt = "0.1.5"
examples/numbers/sqrt-of-integer/src/main.rs
use integer_sqrt::IntegerSquareRoot; fn main() { let x = 16; println!("{}", x.integer_sqrt()); }