Open IGI-111 opened 4 months ago
#[test]
fn u32_pow() -> () {
disable_panic_on_overflow();
let x: u32 = 2;
let y: u32 = 64;
let z = x.pow(y); //this becomes 2**32, since u32 are essentially u64 under disguise, and explicit checks must be made to ensure values fall within range
assert(z == 0);
()
}
#[test]
fn u64_pow() -> () {
disable_panic_on_overflow();
let x: u64 = 2;
let y: u32 = 64;
let z = x.pow(y);
assert(z == 0);
()
}
pow may return results where the value is superior to the type maximum due to all primitive types of size < 8 bytes being treated as u64