saxbophone / arby

Arbitrary precision arithmetic in C++, even at compile-time
https://saxbophone.com/arby/
Mozilla Public License 2.0
8 stars 1 forks source link

Remove math support header and put functions into Nat.hpp as friends #138

Closed saxbophone closed 1 year ago

saxbophone commented 1 year ago

Having these in their own separate header has always felt a bit weird. Having them as friend functions makes much more sense.

That way, each arbitrary type has its own log, pow and root function, but they're friends so you don't need to use them with the class name. This provides overloaded behaviour across the different types —i.e. there's an ipow() for Nat, Int and Rat

Note: Consider whether we want to call it ipow() in light of the fact that Rat provides rational arithmetic, so is not integer (i is short for integer).

saxbophone commented 1 year ago

Actually, they don't need to be made friends, they can just exist as free functions within the Nat header