Average Error: 32.7 → 10.3
Time: 24.0s
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}\;x.re \le -1.572111519748563 \cdot 10^{+25}:\\ \;\;\;\;e^{\log \left({\left(-x.re\right)}^{y.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le -7.308825122735311 \cdot 10^{-240}:\\ \;\;\;\;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}\;x.re \le -6.8450591233717 \cdot 10^{-311}:\\ \;\;\;\;e^{\log \left({\left(-x.re\right)}^{y.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le 4.272218625235376 \cdot 10^{-192} \lor \neg \left(x.re \le 1.3056348567453588 \cdot 10^{-132}\right):\\ \;\;\;\;e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.im \cdot \log x.re + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot 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}\\ \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 x.re < -1.572111519748563e+25 or -7.308825122735311e-240 < x.re < -6.8450591233717e-311

    1. Initial program 38.0

      \[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 20.8

      \[\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 3.4

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

      \[\leadsto \color{blue}{\frac{{\left(-x.re\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}} \cdot 1\]
    5. Using strategy rm
    6. Applied pow-exp9.6

      \[\leadsto \frac{{\left(-x.re\right)}^{y.re}}{\color{blue}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}} \cdot 1\]
    7. Applied add-exp-log9.6

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

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

    if -1.572111519748563e+25 < x.re < -7.308825122735311e-240

    1. Initial program 20.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 11.2

      \[\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 -6.8450591233717e-311 < x.re < 4.272218625235376e-192 or 1.3056348567453588e-132 < x.re

    1. Initial program 35.6

      \[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 22.5

      \[\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 11.8

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

    if 4.272218625235376e-192 < x.re < 1.3056348567453588e-132

    1. Initial program 24.2

      \[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 inf 14.6

      \[\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}{\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{1}{x.re}\right)\right)}\]
    3. Simplified14.6

      \[\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}{\cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re + \log x.re \cdot y.im\right)}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification10.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -1.572111519748563 \cdot 10^{+25}:\\ \;\;\;\;e^{\log \left({\left(-x.re\right)}^{y.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le -7.308825122735311 \cdot 10^{-240}:\\ \;\;\;\;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}\;x.re \le -6.8450591233717 \cdot 10^{-311}:\\ \;\;\;\;e^{\log \left({\left(-x.re\right)}^{y.re}\right) - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{elif}\;x.re \le 4.272218625235376 \cdot 10^{-192} \lor \neg \left(x.re \le 1.3056348567453588 \cdot 10^{-132}\right):\\ \;\;\;\;e^{y.re \cdot \log x.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\cos \left(y.im \cdot \log x.re + y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right) \cdot 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}\\ \end{array}\]

Runtime

Time bar (total: 24.0s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes19.310.34.415.060.2%
herbie shell --seed 2018295 
(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)))))