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

Function ldexp

crates/stdlib/src/math.rs:408–418  ·  view source on GitHub ↗
(
        x: Either<PyRef<PyFloat>, PyIntRef>,
        i: PyIntRef,
        vm: &VirtualMachine,
    )

Source from the content-addressed store, hash-verified

406
407 #[pyfunction]
408 fn ldexp(
409 x: Either<PyRef<PyFloat>, PyIntRef>,
410 i: PyIntRef,
411 vm: &VirtualMachine,
412 ) -> PyResult<f64> {
413 let value = match x {
414 Either::A(f) => f.to_f64(),
415 Either::B(z) => try_bigint_to_f64(z.as_bigint(), vm)?,
416 };
417 pymath::math::ldexp_bigint(value, i.as_bigint()).map_err(|err| pymath_exception(err, vm))
418 }
419
420 #[pyfunction]
421 fn cbrt(x: ArgIntoFloat, vm: &VirtualMachine) -> PyResult<f64> {

Callers 3

test_endsMethod · 0.90
test_roundtripMethod · 0.90

Calls 3

pymath_exceptionFunction · 0.85
to_f64Method · 0.80
as_bigintMethod · 0.80

Tested by 3

test_endsMethod · 0.72
test_roundtripMethod · 0.72