| 537 | } |
| 538 | |
| 539 | static PyObject* |
| 540 | pyrational_str(PyObject* self) { |
| 541 | rational x = ((PyRational*)self)->r; |
| 542 | if (d(x)!=1) { |
| 543 | return PyUnicode_FromFormat( |
| 544 | "%ld/%ld",(long)x.n,(long)d(x)); |
| 545 | } |
| 546 | else { |
| 547 | return PyUnicode_FromFormat( |
| 548 | "%ld",(long)x.n); |
| 549 | } |
| 550 | } |
| 551 | |
| 552 | static npy_hash_t |
| 553 | pyrational_hash(PyObject* self) { |