Average Error: 33.4 → 6.2
Time: 31.3s
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 2.6352470843791477 \cdot 10^{-205}:\\ \;\;\;\;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}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \left(\sqrt[3]{y.re} \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \sqrt[3]{y.re}\right)\right) \cdot \sqrt[3]{y.re}\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot 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 2.6352470843791477 \cdot 10^{-205}:\\
\;\;\;\;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}:\\
\;\;\;\;\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \left(\sqrt[3]{y.re} \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \sqrt[3]{y.re}\right)\right) \cdot \sqrt[3]{y.re}\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r24596 = x_re;
        double r24597 = r24596 * r24596;
        double r24598 = x_im;
        double r24599 = r24598 * r24598;
        double r24600 = r24597 + r24599;
        double r24601 = sqrt(r24600);
        double r24602 = log(r24601);
        double r24603 = y_re;
        double r24604 = r24602 * r24603;
        double r24605 = atan2(r24598, r24596);
        double r24606 = y_im;
        double r24607 = r24605 * r24606;
        double r24608 = r24604 - r24607;
        double r24609 = exp(r24608);
        double r24610 = r24602 * r24606;
        double r24611 = r24605 * r24603;
        double r24612 = r24610 + r24611;
        double r24613 = sin(r24612);
        double r24614 = r24609 * r24613;
        return r24614;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r24615 = x_re;
        double r24616 = r24615 * r24615;
        double r24617 = x_im;
        double r24618 = r24617 * r24617;
        double r24619 = r24616 + r24618;
        double r24620 = sqrt(r24619);
        double r24621 = log(r24620);
        double r24622 = y_re;
        double r24623 = r24621 * r24622;
        double r24624 = atan2(r24617, r24615);
        double r24625 = y_im;
        double r24626 = r24624 * r24625;
        double r24627 = r24623 - r24626;
        double r24628 = exp(r24627);
        double r24629 = r24621 * r24625;
        double r24630 = r24624 * r24622;
        double r24631 = r24629 + r24630;
        double r24632 = sin(r24631);
        double r24633 = r24628 * r24632;
        double r24634 = 2.6352470843791477e-205;
        bool r24635 = r24633 <= r24634;
        double r24636 = hypot(r24615, r24617);
        double r24637 = log(r24636);
        double r24638 = cbrt(r24622);
        double r24639 = r24624 * r24638;
        double r24640 = r24638 * r24639;
        double r24641 = r24640 * r24638;
        double r24642 = fma(r24637, r24625, r24641);
        double r24643 = sin(r24642);
        double r24644 = pow(r24636, r24622);
        double r24645 = exp(r24626);
        double r24646 = r24644 / r24645;
        double r24647 = r24643 * r24646;
        double r24648 = r24635 ? r24633 : r24647;
        return r24648;
}

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 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)))) < 2.6352470843791477e-205

    1. Initial program 1.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 \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 2.6352470843791477e-205 < (* (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 54.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 \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.9

      \[\leadsto \color{blue}{\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) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}}\]
    3. Using strategy rm
    4. Applied add-cube-cbrt9.2

      \[\leadsto \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 \color{blue}{\left(\left(\sqrt[3]{y.re} \cdot \sqrt[3]{y.re}\right) \cdot \sqrt[3]{y.re}\right)}\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\]
    5. Applied associate-*r*9.2

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

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

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

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

    \[\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 2.6352470843791477 \cdot 10^{-205}:\\ \;\;\;\;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}:\\ \;\;\;\;\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \left(\sqrt[3]{y.re} \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \sqrt[3]{y.re}\right)\right) \cdot \sqrt[3]{y.re}\right)\right) \cdot \frac{{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)}^{y.re}}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019198 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :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)))))