MCPcopy Index your code
hub / github.com/RustPython/RustPython / execute_binary_op_float

Method execute_binary_op_float

crates/vm/src/frame.rs:8158–8178  ·  view source on GitHub ↗
(
        &mut self,
        vm: &VirtualMachine,
        op: impl FnOnce(f64, f64) -> f64,
        deopt_op: bytecode::BinaryOperator,
    )

Source from the content-addressed store, hash-verified

8156 /// Fallback to generic binary op if either operand is not an exact float.
8157 #[inline]
8158 fn execute_binary_op_float(
8159 &mut self,
8160 vm: &VirtualMachine,
8161 op: impl FnOnce(f64, f64) -> f64,
8162 deopt_op: bytecode::BinaryOperator,
8163 ) -> FrameResult {
8164 let b = self.top_value();
8165 let a = self.nth_value(1);
8166 if let (Some(a_f), Some(b_f)) = (
8167 a.downcast_ref_if_exact::<PyFloat>(vm),
8168 b.downcast_ref_if_exact::<PyFloat>(vm),
8169 ) {
8170 let result = op(a_f.to_f64(), b_f.to_f64());
8171 self.pop_value();
8172 self.pop_value();
8173 self.push_value(vm.ctx.new_float(result).into());
8174 Ok(None)
8175 } else {
8176 self.execute_bin_op(vm, deopt_op)
8177 }
8178 }
8179
8180 fn specialize_call(
8181 &mut self,

Callers 1

execute_instructionMethod · 0.80

Calls 7

top_valueMethod · 0.80
nth_valueMethod · 0.80
to_f64Method · 0.80
pop_valueMethod · 0.80
push_valueMethod · 0.80
execute_bin_opMethod · 0.80
new_floatMethod · 0.45

Tested by

no test coverage detected