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

Function rational_floor

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

Source from the content-addressed store, hash-verified

221}
222
223static inline npy_int64
224rational_floor(rational x) {
225 /* Always round down */
226 if (x.n>=0) {
227 return x.n/d(x);
228 }
229 /*
230 * This can be done without casting up to 64 bits, but it requires
231 * working out all the sign cases
232 */
233 return -((-(npy_int64)x.n+d(x)-1)/d(x));
234}
235
236static inline npy_int64
237rational_ceil(rational x) {

Callers 4

rational_ceilFunction · 0.85
rational_remainderFunction · 0.85
RATIONAL_BINOPFunction · 0.85
pyrational_richcompareFunction · 0.85

Calls 1

dFunction · 0.85

Tested by

no test coverage detected