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
Replace std::pow with integer exponent #13321
Comments
Which optimization flags are you passing to the compiler? With |
I used whatever release mode gave me. But you already get different answers if |
Here is a better regex:
|
If you use |
That's funny, I thought this was automatic (at least for n =2,3,4). I thought this was only an issue if you made the mistake of writing std::pow(x,2.) instead of std::pow(x,2)... |
IIRC, we have |
Current state: The So the only thing left to finish this is the change to step-82, which will require the following regex replace:
|
A possibly surprising realization from geodynamics/aspect#4456 is that
std::pow(x,p)
with fixed integer exponentp
is vastly more expensive than just writing out the product, at least for relatively small integersp
. We should take a look at our code base and see whether there is something that's worth replacing. These 108 places might be a good starting point to look at:The text was updated successfully, but these errors were encountered: