Rust doesn't have an Integer Squareroot function, but needs it.
I raised this issue in Ruby, and they included it in version 2.5 (2.7 was just released Dec 25, 2019).
For large integers, doing something like:
(n as f64).sqrt() as usize
will start producing errors above a certain size. This is an inherent limitation of floating point math.
See article here describing problem:
This floating point conversion bug starts to show up early for large 64-bit integers.
This is a necessary fix to implement many numerical algorithms correctly, e.g. in cryptography, which use very large integers.
Discussion in Ruby issue tracker on which implementation to use.