\[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: 39.0 s
Input Error: 32.6
Output Error: 1.7
Log:
Profile: 🕒
\(\begin{cases} \frac{{\left(\sqrt{x.im^2 + x.re^2}^*\right)}^{y.re}}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + \left(1 + \frac{1}{2} \cdot \left({\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}^2 \cdot {y.im}^2\right)\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) & \text{when } y.re \le -3.4496838170280365 \cdot 10^{+48} \\ \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 \left(\cos \left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \sin \left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) \cdot \log \left(e^{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}\right)\right) & \text{otherwise} \end{cases}\)

    if y.re < -3.4496838170280365e+48

    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)\]
      39.6
    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)}\]
      15.1
    3. Applied taylor to get
      \[\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) \leadsto \frac{{\left(\sqrt{x.im^2 + x.re^2}^*\right)}^{y.re}}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + \left(1 + \frac{1}{2} \cdot \left({\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}^2 \cdot {y.im}^2\right)\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)\]
      2.5
    4. Taylor expanded around 0 to get
      \[\frac{{\left(\sqrt{x.im^2 + x.re^2}^*\right)}^{y.re}}{\color{red}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + \left(1 + \frac{1}{2} \cdot \left({\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}^2 \cdot {y.im}^2\right)\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}{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im + \left(1 + \frac{1}{2} \cdot \left({\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}^2 \cdot {y.im}^2\right)\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)\]
      2.5

    if -3.4496838170280365e+48 < y.re

    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)\]
      30.1
    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)}\]
      1.5
    3. Using strategy rm
      1.5
    4. Applied fma-udef to get
      \[\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 \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}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \cos \color{blue}{\left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}\]
      1.5
    5. Applied cos-sum to get
      \[\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 \color{red}{\cos \left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right) + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)} \leadsto \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 \color{blue}{\left(\cos \left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \sin \left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) \cdot \sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)}\]
      1.5
    6. Using strategy rm
      1.5
    7. Applied add-log-exp to get
      \[\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 \left(\cos \left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \sin \left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) \cdot \color{red}{\sin \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}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}} \cdot \left(\cos \left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) \cdot \cos \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) - \sin \left(y.im \cdot \log \left(\sqrt{x.im^2 + x.re^2}^*\right)\right) \cdot \color{blue}{\log \left(e^{\sin \left(y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)}\right)}\right)\]
      1.5

  1. 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)))))