I see (left+right)/2. Is it like python with unbounded precision?
I see (left+right)/2. Is it like python with unbounded precision?
[1]: https://doc.rust-lang.org/stable/reference/types/numeric.htm...
There is no (left+right)/2 on that page.
let mid = left + size / 2;
It's only size that is being divided by 2, which is the size of the segment still under consideration (which is initially the whole array). left is the starting index of segment still under consideration (which is initially 0).This array would not fit in any kind of memory for the foreseeable future :)
https://doc.rust-lang.org/nightly/rustc/platform-support.htm...
Where do you see that in the code? I can't see (left+right)/2 anywhere in the code I linked?
No, it uses 2’s complement and is well defined in release mode. From [1]:
> When you’re compiling in release mode with the --release flag, Rust does not include checks for integer overflow that cause panics. Instead, if overflow occurs, Rust performs two’s complement wrapping.
[1]: https://doc.rust-lang.org/book/ch03-02-data-types.html#integ...