Average Error: 33.0 → 8.4
Time: 28.3s
Precision: 64
Internal Precision: 1344
\[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)\]
\[\begin{array}{l} \mathbf{if}\;\tan^{-1}_* \frac{x.im}{x.re} \le -1.5707982218300465:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;\tan^{-1}_* \frac{x.im}{x.re} \le -1.5707963267948966:\\ \;\;\;\;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}\\ \mathbf{elif}\;\tan^{-1}_* \frac{x.im}{x.re} \le 4.120236092806811 \cdot 10^{-118}:\\ \;\;\;\;e^{\sqrt[3]{\log x.re} \cdot \left(\left(\sqrt[3]{\log x.re} \cdot \sqrt[3]{\log x.re}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;\tan^{-1}_* \frac{x.im}{x.re} \le 1.5707963267948966:\\ \;\;\;\;e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if (atan2 x.im x.re) < -1.5707982218300465 or 1.5707963267948966 < (atan2 x.im x.re)

    1. Initial program 31.7

      \[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)\]
    2. Taylor expanded around 0 18.3

      \[\leadsto 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 \color{blue}{1}\]
    3. Taylor expanded around -inf 0.8

      \[\leadsto e^{\log \color{blue}{\left(-1 \cdot x.re\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
    4. Simplified0.8

      \[\leadsto e^{\log \color{blue}{\left(-x.re\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]

    if -1.5707982218300465 < (atan2 x.im x.re) < -1.5707963267948966

    1. Initial program 31.9

      \[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)\]
    2. Taylor expanded around 0 18.1

      \[\leadsto 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 \color{blue}{1}\]

    if -1.5707963267948966 < (atan2 x.im x.re) < 4.120236092806811e-118

    1. Initial program 37.7

      \[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)\]
    2. Taylor expanded around 0 26.1

      \[\leadsto 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 \color{blue}{1}\]
    3. Taylor expanded around inf 14.3

      \[\leadsto e^{\color{blue}{-1 \cdot \left(y.re \cdot \log \left(\frac{1}{x.re}\right)\right)} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
    4. Simplified14.3

      \[\leadsto e^{\color{blue}{y.re \cdot \log x.re} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
    5. Using strategy rm
    6. Applied add-cube-cbrt14.3

      \[\leadsto e^{y.re \cdot \color{blue}{\left(\left(\sqrt[3]{\log x.re} \cdot \sqrt[3]{\log x.re}\right) \cdot \sqrt[3]{\log x.re}\right)} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
    7. Applied associate-*r*14.3

      \[\leadsto e^{\color{blue}{\left(y.re \cdot \left(\sqrt[3]{\log x.re} \cdot \sqrt[3]{\log x.re}\right)\right) \cdot \sqrt[3]{\log x.re}} - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]

    if 4.120236092806811e-118 < (atan2 x.im x.re) < 1.5707963267948966

    1. Initial program 30.9

      \[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)\]
    2. Taylor expanded around 0 17.9

      \[\leadsto 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 \color{blue}{1}\]
    3. Taylor expanded around 0 1.7

      \[\leadsto e^{\color{blue}{y.re \cdot \log x.im - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}} \cdot 1\]
  3. Recombined 4 regimes into one program.
  4. Final simplification8.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;\tan^{-1}_* \frac{x.im}{x.re} \le -1.5707982218300465:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;\tan^{-1}_* \frac{x.im}{x.re} \le -1.5707963267948966:\\ \;\;\;\;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}\\ \mathbf{elif}\;\tan^{-1}_* \frac{x.im}{x.re} \le 4.120236092806811 \cdot 10^{-118}:\\ \;\;\;\;e^{\sqrt[3]{\log x.re} \cdot \left(\left(\sqrt[3]{\log x.re} \cdot \sqrt[3]{\log x.re}\right) \cdot y.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;\tan^{-1}_* \frac{x.im}{x.re} \le 1.5707963267948966:\\ \;\;\;\;e^{y.re \cdot \log x.im - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;e^{y.re \cdot \log \left(-x.re\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \end{array}\]

Runtime

Time bar (total: 28.3s)Debug logProfile

herbie shell --seed 2018274 
(FPCore (x.re x.im y.re y.im)
  :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)))))