\[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 \sin \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, imaginary 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: 27.3 s
Input Error: 33.0
Output Error: 4.1
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 \log_* (1 + (e^{\sin \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)^*)\)
  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 \sin \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)\]
    33.0
  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 \sin \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 \sin \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.9
  3. Using strategy rm
    4.9
  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 \sin \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 \sin \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.1
  5. Using strategy rm
    4.1
  6. Applied log1p-expm1-u 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 \color{red}{\sin \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 \color{blue}{\log_* (1 + (e^{\sin \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)^*)}\]
    4.1

  7. Removed slow pow expressions

Original test:


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