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

Function modf

std/math/src/main/float.rs:234–239  ·  view source on GitHub ↗
(x: f64)

Source from the content-addressed store, hash-verified

232// `modf(x) -> (fractional, integral)`, both with the sign of `x`.
233#[plugin_fn]
234fn modf(x: f64) -> Result<Handle> {
235 let integral = libm::trunc(x);
236 let frac = encode(Value::Float(x - integral))?;
237 let ip = encode(Value::Float(integral))?;
238 Handle::new_tuple(&[frac.raw(), ip.raw()])
239}
240
241// `frexp(x) -> (mantissa, exponent)` with `x == mantissa * 2**exponent`.
242#[plugin_fn]

Callers

nothing calls this directly

Calls 3

truncFunction · 0.85
encodeFunction · 0.50
rawMethod · 0.45

Tested by

no test coverage detected