Assumes d_ > 0 */
| 171 | |
| 172 | /* Assumes d_ > 0 */ |
| 173 | static rational |
| 174 | make_rational_fast(npy_int64 n_, npy_int64 d_) { |
| 175 | npy_int64 g = gcd(n_,d_); |
| 176 | rational r; |
| 177 | n_ /= g; |
| 178 | d_ /= g; |
| 179 | r.n = (npy_int32)n_; |
| 180 | r.dmm = (npy_int32)(d_-1); |
| 181 | if (r.n!=n_ || r.dmm+1!=d_) { |
| 182 | set_overflow(); |
| 183 | } |
| 184 | return r; |
| 185 | } |
| 186 | |
| 187 | static inline rational |
| 188 | rational_negative(rational r) { |
no test coverage detected