Average Error: 32.2 → 10.0
Time: 1.3m
Precision: 64
Ground Truth: 128
\[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.im \le -70354840459822.195:\\ \;\;\;\;\frac{{\left(-x.im\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\\ \mathbf{if}\;x.im \le -8.690284157163935 \cdot 10^{-160}:\\ \;\;\;\;e^{\log \left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{if}\;x.im \le -1.4728059222611327 \cdot 10^{-182}:\\ \;\;\;\;\frac{{\left(-x.im\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\\ \mathbf{if}\;x.im \le 1.1533951054207925 \cdot 10^{+185}:\\ \;\;\;\;e^{\log \left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \mathbf{if}\;x.im \le 1.8521456453653478 \cdot 10^{+275}:\\ \;\;\;\;\frac{{x.im}^{\left(-y.re\right)}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\\ \mathbf{else}:\\ \;\;\;\;e^{\log \left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\\ \end{array}\]

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Split input into 3 regimes.
  2. if x.im < -70354840459822.195 or -8.690284157163935e-160 < x.im < -1.4728059222611327e-182

    1. Initial program 40.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. Applied simplify 40.0

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

      \[\leadsto 1 \cdot \frac{{\left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\]
    4. Taylor expanded around 0 22.7

      \[\leadsto \color{blue}{1} \cdot \frac{{\left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\]
    5. Applied simplify 22.7

      \[\leadsto \color{blue}{\frac{{\left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}}\]
    6. Applied taylor 0.7

      \[\leadsto \frac{{\left(-1 \cdot x.im\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\]
    7. Taylor expanded around -inf 0.7

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

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

    if -70354840459822.195 < x.im < -8.690284157163935e-160 or -1.4728059222611327e-182 < x.im < 1.1533951054207925e+185 or 1.8521456453653478e+275 < x.im

    1. Initial program 26.8

      \[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. Applied simplify 30.9

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

      \[\leadsto 1 \cdot \frac{{\left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\]
    4. Taylor expanded around 0 20.7

      \[\leadsto \color{blue}{1} \cdot \frac{{\left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\]
    5. Applied simplify 20.7

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

      \[\leadsto \frac{{\left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right)}^{y.re}}{\color{blue}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}}\]
    8. Applied add-exp-log 18.3

      \[\leadsto \frac{{\color{blue}{\left(e^{\log \left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right)}\right)}}^{y.re}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\]
    9. Applied pow-exp 18.3

      \[\leadsto \frac{\color{blue}{e^{\log \left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right) \cdot y.re}}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\]
    10. Applied div-exp 13.9

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

    if 1.1533951054207925e+185 < x.im < 1.8521456453653478e+275

    1. Initial program 62.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. Applied simplify 62.6

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

      \[\leadsto 1 \cdot \frac{{\left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\]
    4. Taylor expanded around 0 54.9

      \[\leadsto \color{blue}{1} \cdot \frac{{\left(\sqrt{x.im \cdot x.im + x.re \cdot x.re}\right)}^{y.re}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}\]
    5. Applied simplify 54.9

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

      \[\leadsto \frac{{\left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right)}^{y.re}}{\color{blue}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}}\]
    8. Applied add-exp-log 54.9

      \[\leadsto \frac{{\color{blue}{\left(e^{\log \left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right)}\right)}}^{y.re}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\]
    9. Applied pow-exp 54.9

      \[\leadsto \frac{\color{blue}{e^{\log \left(\sqrt{{x.im}^2 + x.re \cdot x.re}\right) \cdot y.re}}}{e^{y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}}\]
    10. Applied div-exp 54.9

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

      \[\leadsto e^{-1 \cdot \left(y.re \cdot \log x.im\right) - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}}\]
    12. Taylor expanded around inf 0.1

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

      \[\leadsto \color{blue}{\frac{{x.im}^{\left(-y.re\right)}}{{\left(e^{y.im}\right)}^{\left(\tan^{-1}_* \frac{x.im}{x.re}\right)}}}\]
  3. Recombined 3 regimes into one program.
  4. Removed slow pow expressions

Runtime

Total time: 1.3m Debug log

Please include this information when filing a bug report:

herbie --seed '#(498291016 2175574726 2550883254 1321108524 2226331312 2479496205)'
(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)))))