MCPcopy Create free account
hub / github.com/dylan-sutton-chavez/edge-python / div_vals

Method div_vals

compiler/src/modules/vm/ops.rs:558–563  ·  view source on GitHub ↗
(&mut self, a: Val, b: Val)

Source from the content-addressed store, hash-verified

556 }
557
558 pub fn div_vals(&mut self, a: Val, b: Val) -> Result<Val, VmErr> {
559 let bv = self.to_f64_coerce(b).map_err(|_| cold_type("'/' requires numeric operands"))?;
560 if bv == 0.0 { return Err(VmErr::ZeroDiv); }
561 let av = self.to_f64_coerce(a).map_err(|_| cold_type("'/' requires numeric operands"))?;
562 Ok(Val::float(av / bv))
563 }
564
565 /* Method wrapper around the free `as_i128` for borrow-checker ergonomics. */
566 #[inline]

Callers 1

handle_arithMethod · 0.80

Calls 2

cold_typeFunction · 0.85
to_f64_coerceMethod · 0.80

Tested by

no test coverage detected