This can (obviously) be done to replace any multiplication. The problem is that 2 logs, an add, and an exponentiation are a lot slower than a single multiply.
You can check the code, I don't just replace multiplication, I perform addition (with tricks) in log space