Average Error: 32.9 → 21.9
Time: 8.5s
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.6451078206490934 \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.6451078206490934 \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 r20015 = x_re;
        double r20016 = r20015 * r20015;
        double r20017 = x_im;
        double r20018 = r20017 * r20017;
        double r20019 = r20016 + r20018;
        double r20020 = sqrt(r20019);
        double r20021 = log(r20020);
        double r20022 = y_re;
        double r20023 = r20021 * r20022;
        double r20024 = atan2(r20017, r20015);
        double r20025 = y_im;
        double r20026 = r20024 * r20025;
        double r20027 = r20023 - r20026;
        double r20028 = exp(r20027);
        double r20029 = r20021 * r20025;
        double r20030 = r20024 * r20022;
        double r20031 = r20029 + r20030;
        double r20032 = sin(r20031);
        double r20033 = r20028 * r20032;
        return r20033;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r20034 = x_re;
        double r20035 = -5.645107820649093e-309;
        bool r20036 = r20034 <= r20035;
        double r20037 = r20034 * r20034;
        double r20038 = x_im;
        double r20039 = r20038 * r20038;
        double r20040 = r20037 + r20039;
        double r20041 = sqrt(r20040);
        double r20042 = log(r20041);
        double r20043 = y_re;
        double r20044 = r20042 * r20043;
        double r20045 = atan2(r20038, r20034);
        double r20046 = y_im;
        double r20047 = r20045 * r20046;
        double r20048 = r20044 - r20047;
        double r20049 = exp(r20048);
        double r20050 = r20045 * r20043;
        double r20051 = -1.0;
        double r20052 = r20051 / r20034;
        double r20053 = log(r20052);
        double r20054 = r20046 * r20053;
        double r20055 = r20050 - r20054;
        double r20056 = sin(r20055);
        double r20057 = r20049 * r20056;
        double r20058 = log(r20034);
        double r20059 = r20058 * r20046;
        double r20060 = r20059 + r20050;
        double r20061 = sin(r20060);
        double r20062 = r20049 * r20061;
        double r20063 = r20036 ? r20057 : r20062;
        return r20063;
}

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.645107820649093e-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 19.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.645107820649093e-309 < x.re

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

      \[\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 simplification21.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -5.6451078206490934 \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 2020056 
(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)))))