Average Error: 33.3 → 5.8
Time: 15.7s
Precision: 64
\[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)\]
\[\begin{array}{l} \mathbf{if}\;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) \le -0.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 \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)\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)\right) \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\\ \end{array}\]
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)
\begin{array}{l}
\mathbf{if}\;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) \le -0.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 \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)\\

\mathbf{else}:\\
\;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)\right) \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r23514 = x_re;
        double r23515 = r23514 * r23514;
        double r23516 = x_im;
        double r23517 = r23516 * r23516;
        double r23518 = r23515 + r23517;
        double r23519 = sqrt(r23518);
        double r23520 = log(r23519);
        double r23521 = y_re;
        double r23522 = r23520 * r23521;
        double r23523 = atan2(r23516, r23514);
        double r23524 = y_im;
        double r23525 = r23523 * r23524;
        double r23526 = r23522 - r23525;
        double r23527 = exp(r23526);
        double r23528 = r23520 * r23524;
        double r23529 = r23523 * r23521;
        double r23530 = r23528 + r23529;
        double r23531 = sin(r23530);
        double r23532 = r23527 * r23531;
        return r23532;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r23533 = x_re;
        double r23534 = r23533 * r23533;
        double r23535 = x_im;
        double r23536 = r23535 * r23535;
        double r23537 = r23534 + r23536;
        double r23538 = sqrt(r23537);
        double r23539 = log(r23538);
        double r23540 = y_re;
        double r23541 = r23539 * r23540;
        double r23542 = atan2(r23535, r23533);
        double r23543 = y_im;
        double r23544 = r23542 * r23543;
        double r23545 = r23541 - r23544;
        double r23546 = exp(r23545);
        double r23547 = r23539 * r23543;
        double r23548 = r23542 * r23540;
        double r23549 = r23547 + r23548;
        double r23550 = sin(r23549);
        double r23551 = r23546 * r23550;
        double r23552 = -0.0;
        bool r23553 = r23551 <= r23552;
        double r23554 = hypot(r23533, r23535);
        double r23555 = pow(r23554, r23540);
        double r23556 = log(r23554);
        double r23557 = r23556 * r23543;
        double r23558 = sin(r23557);
        double r23559 = log1p(r23558);
        double r23560 = expm1(r23559);
        double r23561 = cos(r23548);
        double r23562 = r23560 * r23561;
        double r23563 = cos(r23557);
        double r23564 = sin(r23548);
        double r23565 = r23563 * r23564;
        double r23566 = r23562 + r23565;
        double r23567 = r23555 * r23566;
        double r23568 = cbrt(r23543);
        double r23569 = cbrt(r23568);
        double r23570 = r23569 * r23569;
        double r23571 = r23570 * r23569;
        double r23572 = r23568 * r23571;
        double r23573 = r23542 * r23572;
        double r23574 = r23573 * r23568;
        double r23575 = exp(r23574);
        double r23576 = r23567 / r23575;
        double r23577 = r23553 ? r23551 : r23576;
        return r23577;
}

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 2 regimes
  2. if (* (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)))) < -0.0

    1. Initial program 1.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 \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)\]

    if -0.0 < (* (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))))

    1. Initial program 53.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 \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)\]
    2. Simplified8.4

      \[\leadsto \color{blue}{\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot \color{blue}{\left(\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \sqrt[3]{y.im}\right)}}}\]
    5. Applied associate-*r*8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\color{blue}{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)\right) \cdot \sqrt[3]{y.im}}}}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)}\right)\right) \cdot \sqrt[3]{y.im}}}\]
    8. Using strategy rm
    9. Applied fma-udef8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \sin \color{blue}{\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)}}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\]
    10. Applied sin-sum8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \color{blue}{\left(\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\]
    11. Using strategy rm
    12. Applied expm1-log1p-u8.4

      \[\leadsto \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \left(\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)\right)} \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification5.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;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) \le -0.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 \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)\\ \mathbf{else}:\\ \;\;\;\;\frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re} \cdot \left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right)\right)\right) \cdot \cos \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right) + \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im\right) \cdot \sin \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)}{e^{\left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y.im}} \cdot \sqrt[3]{\sqrt[3]{y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{y.im}}\right)\right)\right) \cdot \sqrt[3]{y.im}}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020047 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, imaginary part"
  :precision binary64
  (* (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)))))