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

Function gcd

std/math/src/main/int.rs:37–44  ·  view source on GitHub ↗
(nums: Args)

Source from the content-addressed store, hash-verified

35// Variadic gcd, matching `math.gcd(*integers)`; `gcd()` is 0.
36#[plugin_fn]
37fn gcd(nums: Args) -> Result<i128> {
38 let mut g: i128 = 0;
39 for h in &nums.0 {
40 let n = i128::from_handle(h.raw())?;
41 g = gcd2(g, n.abs());
42 }
43 Ok(g)
44}
45
46// Variadic lcm, matching `math.lcm(*integers)`; `lcm()` is 1, any zero yields 0.
47#[plugin_fn]

Callers

nothing calls this directly

Calls 2

gcd2Function · 0.85
rawMethod · 0.45

Tested by

no test coverage detected