(&mut self, a: Val, b: Val)
| 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] |
no test coverage detected