MCPcopy Create free account
hub / github.com/numpy/numpy / lcm

Function lcm

numpy/core/src/umath/_rational_tests.c:105–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105static inline npy_int64
106lcm(npy_int64 x, npy_int64 y) {
107 npy_int64 lcm;
108 if (!x || !y) {
109 return 0;
110 }
111 x /= gcd(x,y);
112 lcm = x*y;
113 if (lcm/y!=x) {
114 set_overflow();
115 }
116 return safe_abs64(lcm);
117}
118
119/* Fixed precision rational numbers */
120

Callers 1

pyrational_richcompareFunction · 0.85

Calls 3

gcdFunction · 0.85
set_overflowFunction · 0.85
safe_abs64Function · 0.85

Tested by

no test coverage detected