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

Function rational_inverse

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

Source from the content-addressed store, hash-verified

268}
269
270static inline rational
271rational_inverse(rational x) {
272 rational y = {0};
273 if (!x.n) {
274 set_zero_divide();
275 }
276 else {
277 npy_int32 d_;
278 y.n = d(x);
279 d_ = x.n;
280 if (d_ <= 0) {
281 d_ = safe_neg(d_);
282 y.n = -y.n;
283 }
284 y.dmm = d_-1;
285 }
286 return y;
287}
288
289static inline int
290rational_eq(rational x, rational y) {

Callers 1

pyrational_richcompareFunction · 0.85

Calls 3

set_zero_divideFunction · 0.85
dFunction · 0.85
safe_negFunction · 0.85

Tested by

no test coverage detected