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

Function rational_rint

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

Source from the content-addressed store, hash-verified

253}
254
255static inline npy_int64
256rational_rint(rational x) {
257 /*
258 * Round towards nearest integer, moving exact half integers towards
259 * zero
260 */
261 npy_int32 d_ = d(x);
262 return (2*(npy_int64)x.n+(x.n<0?-d_:d_))/(2*(npy_int64)d_);
263}
264
265static inline int
266rational_sign(rational x) {

Callers 1

pyrational_richcompareFunction · 0.85

Calls 1

dFunction · 0.85

Tested by

no test coverage detected