Closed aplavin closed 9 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Comparison is base (
d397fef
) 100.00% compared to head (7856164
) 100.00%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hm, one the one hand, this makes things more consistent. But it does introduce type instabilities, and the functions in question may well be used in time-critical code.
I would suggest to keep throwing an exception here for practical reasons. True, we'll then get a failure on certain single points, e.g. at zero. But on the other hand, if an application encounters a zero in such places, it's very likely that something is wrong, and throwing an exception would make sense.
The idea behind NoInverse
is to enable code to check if a function is invertible, and then take a different code paths if it's not. But I don't think this should come at the cost of type instability.
Yeah, tend to agree with the type stability concerns! I didn't manage to write any small self-contained benchmark that demonstrates any performance difference between NoInverse
vs exception, but agree that type stability should be kept whenever possible.
Currently, some
inverse(non-invertible f)
return NoInverse, some throw an exception. (the latter is code from my earlier PRs, sorry for that!) Here, I make it consistent by always returning NoInverse.