Average Error: 33.7 → 22.5
Time: 9.9s
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}\;x.re \le 8.59677818788519 \cdot 10^{-311}:\\ \;\;\;\;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(-1 \cdot x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{else}:\\ \;\;\;\;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 x.re \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \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}\;x.re \le 8.59677818788519 \cdot 10^{-311}:\\
\;\;\;\;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(-1 \cdot x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\

\mathbf{else}:\\
\;\;\;\;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 x.re \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r21635 = x_re;
        double r21636 = r21635 * r21635;
        double r21637 = x_im;
        double r21638 = r21637 * r21637;
        double r21639 = r21636 + r21638;
        double r21640 = sqrt(r21639);
        double r21641 = log(r21640);
        double r21642 = y_re;
        double r21643 = r21641 * r21642;
        double r21644 = atan2(r21637, r21635);
        double r21645 = y_im;
        double r21646 = r21644 * r21645;
        double r21647 = r21643 - r21646;
        double r21648 = exp(r21647);
        double r21649 = r21641 * r21645;
        double r21650 = r21644 * r21642;
        double r21651 = r21649 + r21650;
        double r21652 = sin(r21651);
        double r21653 = r21648 * r21652;
        return r21653;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r21654 = x_re;
        double r21655 = 8.5967781878852e-311;
        bool r21656 = r21654 <= r21655;
        double r21657 = r21654 * r21654;
        double r21658 = x_im;
        double r21659 = r21658 * r21658;
        double r21660 = r21657 + r21659;
        double r21661 = sqrt(r21660);
        double r21662 = log(r21661);
        double r21663 = y_re;
        double r21664 = r21662 * r21663;
        double r21665 = atan2(r21658, r21654);
        double r21666 = y_im;
        double r21667 = r21665 * r21666;
        double r21668 = r21664 - r21667;
        double r21669 = exp(r21668);
        double r21670 = -1.0;
        double r21671 = r21670 * r21654;
        double r21672 = log(r21671);
        double r21673 = r21672 * r21666;
        double r21674 = r21665 * r21663;
        double r21675 = r21673 + r21674;
        double r21676 = sin(r21675);
        double r21677 = r21669 * r21676;
        double r21678 = log(r21654);
        double r21679 = r21678 * r21666;
        double r21680 = r21679 + r21674;
        double r21681 = sin(r21680);
        double r21682 = r21669 * r21681;
        double r21683 = r21656 ? r21677 : r21682;
        return r21683;
}

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 x.re < 8.5967781878852e-311

    1. Initial program 31.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)\]
    2. Taylor expanded around -inf 20.0

      \[\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 \sin \left(\log \color{blue}{\left(-1 \cdot x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]

    if 8.5967781878852e-311 < x.re

    1. Initial program 35.5

      \[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. Taylor expanded around inf 25.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le 8.59677818788519 \cdot 10^{-311}:\\ \;\;\;\;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(-1 \cdot x.re\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \mathbf{else}:\\ \;\;\;\;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 x.re \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020039 
(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)))))