Closed
Description
Playpen: http://is.gd/zhwksu
fn main() {
let x: i32 = 2;
println!("{}", x.pow(1024));
println!("{}", x.pow(1023));
}
Prints:
0
thread '<main>' panicked at 'arithmetic operation overflowed', ../src/libcore/num/mod.rs:550
Interestingly, this only seems to happen with an even base. The overflow is detected correctly when x
is set to 3 or other odd numbers.
Metadata
Metadata
Assignees
Labels
No labels