\[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
Test:
powComplex, real part
Bits:
128 bits
Bits error versus x.re
Bits error versus x.im
Bits error versus y.re
Bits error versus y.im
Time: 17.8 s
Input Error: 32.5
Output Error: 3.9
Log:
Profile: 🕒
\(\frac{{\left(\sqrt{x.im^2 + x.re^2}^*\right)}^{y.re}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \left({\left(\sqrt[3]{(y.im * \left(\log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) + \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right))_*}\right)}^3\right)\)
  1. Started with
    \[e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    32.5
  2. Applied simplify to get
    \[\color{red}{e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)} \leadsto \color{blue}{\frac{{\left(\sqrt{x.im^2 + x.re^2}^*\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \left((y.im * \left(\log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) + \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right))_*\right)}\]
    4.6
  3. Using strategy rm
    4.6
  4. Applied pow-exp to get
    \[\frac{{\left(\sqrt{x.im^2 + x.re^2}^*\right)}^{y.re}}{\color{red}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}} \cdot \cos \left((y.im * \left(\log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) + \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right))_*\right) \leadsto \frac{{\left(\sqrt{x.im^2 + x.re^2}^*\right)}^{y.re}}{\color{blue}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \cdot \cos \left((y.im * \left(\log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) + \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right))_*\right)\]
    3.9
  5. Using strategy rm
    3.9
  6. Applied add-cube-cbrt to get
    \[\frac{{\left(\sqrt{x.im^2 + x.re^2}^*\right)}^{y.re}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \color{red}{\left((y.im * \left(\log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) + \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right))_*\right)} \leadsto \frac{{\left(\sqrt{x.im^2 + x.re^2}^*\right)}^{y.re}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot \cos \color{blue}{\left({\left(\sqrt[3]{(y.im * \left(\log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) + \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right))_*}\right)}^3\right)}\]
    3.9

  7. Removed slow pow expressions

Original test:


(lambda ((x.re default) (x.im default) (y.re default) (y.im default))
  #:name "powComplex, real part"
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))