(int1: &BigInt, int2: &BigInt, vm: &VirtualMachine)
| 139 | ); |
| 140 | |
| 141 | fn inner_pow(int1: &BigInt, int2: &BigInt, vm: &VirtualMachine) -> PyResult { |
| 142 | if int2.is_negative() { |
| 143 | let v1 = try_to_float(int1, vm)?; |
| 144 | let v2 = try_to_float(int2, vm)?; |
| 145 | float::float_pow(v1, v2, vm) |
| 146 | } else { |
| 147 | let value = if let Some(v2) = int2.to_u64() { |
| 148 | return Ok(vm.ctx.new_int(Pow::pow(int1, v2)).into()); |
| 149 | } else if int1.is_one() { |
| 150 | 1 |
| 151 | } else if int1.is_zero() { |
| 152 | 0 |
| 153 | } else if int1 == &BigInt::from(-1) { |
| 154 | if int2.is_odd() { -1 } else { 1 } |
| 155 | } else { |
| 156 | // missing feature: BigInt exp |
| 157 | // practically, exp over u64 is not possible to calculate anyway |
| 158 | return Ok(vm.ctx.not_implemented()); |
| 159 | }; |
| 160 | Ok(vm.ctx.new_int(value).into()) |
| 161 | } |
| 162 | } |
| 163 | |
| 164 | fn inner_mod(int1: &BigInt, int2: &BigInt, vm: &VirtualMachine) -> PyResult { |
| 165 | if int2.is_zero() { |
no test coverage detected