Fraction numerator denominator helpers
This PR fixes #3595 introduces two new arithmetic functions, num() and den(), which extract the numerator and denominator from Fraction objects respectively.
Thanks for working out these functions
numandden@AnslemHack . Your PR looks well taken care of!I made a few inline comments, can you have a look at those?
On a side note: the detailed description of your PR looks AI-generated and doesn't really add useful information to me 😅. I think it's enough to explain that "this PR addresses #3595, implementing two new functions,
numandden".
my apologise for the verbose @josdejong , I must have over refined my output description, I have now made changes to that with a brief description of what it simply does, hope this is better
Thanks!
A few more items:
re()andim()are in src/function/complex. Shouldn't these be in a new subdirectory src/function/fraction? (Jos?)- Please add some tests showing that num and den do reasonable things on number and bigint input.
- Presumably at the moment num and den will fail on BigNumber input, because there is no implicit conversion from BigNumber to Fraction. But it seems to me that for these two particular functions, what else could one mean but to convert the BigNumber to Fraction and then return the numerator or denominator? So, with @josdejong's blessing, please add an explicit signature for BigNumber for both functions that does the conversion and then returns the numerator or denominator. And then tests for this behavior, of course. Thanks!
A few more items:
re()andim()are in src/function/complex. Shouldn't these be in a new subdirectory src/function/fraction? (Jos?)- Please add some tests showing that num and den do reasonable things on number and bigint input.
- Presumably at the moment num and den will fail on BigNumber input, because there is no implicit conversion from BigNumber to Fraction. But it seems to me that for these two particular functions, what else could one mean but to convert the BigNumber to Fraction and then return the numerator or denominator? So, with @josdejong's blessing, please add an explicit signature for BigNumber for both functions that does the conversion and then returns the numerator or denominator. And then tests for this behavior, of course. Thanks!
thanks for your feedback I have now addressed your concerns. please take another look.