Is there a fast way to take 2.0 to some floating-point degree x? I mean something faster than pow(2.0, x) and preferrably what vectorizes well with AVX2.
The counterpart for integers is 1<<n, but it works for integer n only.
There is a standard std::exp2(double n)
Computes
2raised to the given powern
It is possible that exp2(x) would not be faster than pow(2.0, x) in a particular environment but it's more specific than general pow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With