Average Error: 33.1 → 22.9
Time: 19.6s
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 -5.2751227998900968 \cdot 10^{-309}:\\ \;\;\;\;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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{-1}{x.re}\right)\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 -5.2751227998900968 \cdot 10^{-309}:\\
\;\;\;\;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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{-1}{x.re}\right)\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 r20654 = x_re;
        double r20655 = r20654 * r20654;
        double r20656 = x_im;
        double r20657 = r20656 * r20656;
        double r20658 = r20655 + r20657;
        double r20659 = sqrt(r20658);
        double r20660 = log(r20659);
        double r20661 = y_re;
        double r20662 = r20660 * r20661;
        double r20663 = atan2(r20656, r20654);
        double r20664 = y_im;
        double r20665 = r20663 * r20664;
        double r20666 = r20662 - r20665;
        double r20667 = exp(r20666);
        double r20668 = r20660 * r20664;
        double r20669 = r20663 * r20661;
        double r20670 = r20668 + r20669;
        double r20671 = sin(r20670);
        double r20672 = r20667 * r20671;
        return r20672;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r20673 = x_re;
        double r20674 = -5.275122799890097e-309;
        bool r20675 = r20673 <= r20674;
        double r20676 = r20673 * r20673;
        double r20677 = x_im;
        double r20678 = r20677 * r20677;
        double r20679 = r20676 + r20678;
        double r20680 = sqrt(r20679);
        double r20681 = log(r20680);
        double r20682 = y_re;
        double r20683 = r20681 * r20682;
        double r20684 = atan2(r20677, r20673);
        double r20685 = y_im;
        double r20686 = r20684 * r20685;
        double r20687 = r20683 - r20686;
        double r20688 = exp(r20687);
        double r20689 = r20684 * r20682;
        double r20690 = -1.0;
        double r20691 = r20690 / r20673;
        double r20692 = log(r20691);
        double r20693 = r20685 * r20692;
        double r20694 = r20689 - r20693;
        double r20695 = sin(r20694);
        double r20696 = r20688 * r20695;
        double r20697 = log(r20673);
        double r20698 = r20697 * r20685;
        double r20699 = r20698 + r20689;
        double r20700 = sin(r20699);
        double r20701 = r20688 * r20700;
        double r20702 = r20675 ? r20696 : r20701;
        return r20702;
}

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 < -5.275122799890097e-309

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

    if -5.275122799890097e-309 < x.re

    1. Initial program 34.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. 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.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -5.2751227998900968 \cdot 10^{-309}:\\ \;\;\;\;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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{-1}{x.re}\right)\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 2020042 
(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)))))