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

Function rational_add

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

Source from the content-addressed store, hash-verified

193}
194
195static inline rational
196rational_add(rational x, rational y) {
197 /*
198 * Note that the numerator computation can never overflow int128_t,
199 * since each term is strictly under 2**128/4 (since d > 0).
200 */
201 return make_rational_fast((npy_int64)x.n*d(y)+(npy_int64)d(x)*y.n,
202 (npy_int64)d(x)*d(y));
203}
204
205static inline rational
206rational_subtract(rational x, rational y) {

Callers 5

npyrational_dotFunction · 0.85
npyrational_fillFunction · 0.85
pyrational_richcompareFunction · 0.85
rational_ufunc_test_addFunction · 0.85

Calls 2

make_rational_fastFunction · 0.85
dFunction · 0.85

Tested by

no test coverage detected