Open mach-diamond opened 3 weeks ago
You need some additional checks to make this work. If y is negative and a is zero then you are allowing 1/0 to occur and if a is zero and y is zero then you are saying 0^0 is 1.
As a side note: I don't see strong reasons not to add such a function. Though I agree with @logicalmechanism, the test coverage is pretty thin. We could also leverage prop tests here.
Ah yes, nice catch. I actually had a more robust version of this with more test cases, but I unwisely let it live in the rational.ak
file. And after bumping the std-lib
it got overwritten and lost it lol. And enough time had past where I mostly forgot what I did. Hence the motivation to get this in there natively. I have some pockets of time in next 2 weeks I can use to improve this.
I use this function to exponentiate rational fractions. Simply: (a/b)^c
Any chance we can add this into the library?
With some tests: