-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(re-) Add pow functionality for rational #25
Comments
AMDG
On 07/14/2018 09:22 AM, James E. King III wrote:
<snip>
Recommend looking at adding `operator ^=` as a modifying operator to raise the rational value to an integer exponent. In addition `operator ^` could take an existing rational and raise it to an exponent, returning a new rational.
I strongly disagree with this as operator^ means something
completely different and has the wrong precedence. The correct
name is pow, as long as the issues are dealt with.
In Christ,
Steven Watanabe
|
I was thinking the commonly used mathematic notation of (x^2) would be reasonable here, however the precedence issue is interesting. |
I think perhaps just moving pow into another namespace (ideally boost::rational) would resolve the issue sufficiently and avoid the collision that was happening. |
AMDG
On 08/01/2018 07:22 AM, James E. King III wrote:
I think perhaps just moving pow into another namespace (ideally boost::rational)
boost::rational is a class template. The idea is
sound in principle, but pow does need to be found
by ADL. I suppose that you could just document
that pow lives in an unspecified associated namespace
of rational.
would resolve the issue sufficiently and avoid the collision that was happening.
In Christ,
Steven Watanabe
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
See: #24
In 2015 a pull request added pow() and reciprocal(). In 2018 it was reviewed by CMT and reciprocal() was found to be unnecessary. This left boost::pow() for rational, however it introduced an issue resolving std::pow from within boost namespaces. This happened close to the 1.68.0 release (during beta) so it was removed.
Originally recommend looking at adding
operator ^=
as a modifying operator to raise the rational value to an integer exponent. In additionoperator ^
could take an existing rational and raise it to an exponent, returning a new rational. - note comments below.The text was updated successfully, but these errors were encountered: