Average Error: 33.3 → 22.1
Time: 9.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 1.73062623171225 \cdot 10^{-310}:\\ \;\;\;\;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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{1}{x.re}\right)\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 1.73062623171225 \cdot 10^{-310}:\\
\;\;\;\;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(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re - y.im \cdot \log \left(\frac{1}{x.re}\right)\right)\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r16231 = x_re;
        double r16232 = r16231 * r16231;
        double r16233 = x_im;
        double r16234 = r16233 * r16233;
        double r16235 = r16232 + r16234;
        double r16236 = sqrt(r16235);
        double r16237 = log(r16236);
        double r16238 = y_re;
        double r16239 = r16237 * r16238;
        double r16240 = atan2(r16233, r16231);
        double r16241 = y_im;
        double r16242 = r16240 * r16241;
        double r16243 = r16239 - r16242;
        double r16244 = exp(r16243);
        double r16245 = r16237 * r16241;
        double r16246 = r16240 * r16238;
        double r16247 = r16245 + r16246;
        double r16248 = sin(r16247);
        double r16249 = r16244 * r16248;
        return r16249;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r16250 = x_re;
        double r16251 = 1.73062623171225e-310;
        bool r16252 = r16250 <= r16251;
        double r16253 = r16250 * r16250;
        double r16254 = x_im;
        double r16255 = r16254 * r16254;
        double r16256 = r16253 + r16255;
        double r16257 = sqrt(r16256);
        double r16258 = log(r16257);
        double r16259 = y_re;
        double r16260 = r16258 * r16259;
        double r16261 = atan2(r16254, r16250);
        double r16262 = y_im;
        double r16263 = r16261 * r16262;
        double r16264 = r16260 - r16263;
        double r16265 = exp(r16264);
        double r16266 = -1.0;
        double r16267 = r16266 * r16250;
        double r16268 = log(r16267);
        double r16269 = r16268 * r16262;
        double r16270 = r16261 * r16259;
        double r16271 = r16269 + r16270;
        double r16272 = sin(r16271);
        double r16273 = r16265 * r16272;
        double r16274 = 1.0;
        double r16275 = r16274 / r16250;
        double r16276 = log(r16275);
        double r16277 = r16262 * r16276;
        double r16278 = r16270 - r16277;
        double r16279 = sin(r16278);
        double r16280 = r16265 * r16279;
        double r16281 = r16252 ? r16273 : r16280;
        return r16281;
}

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 < 1.73062623171225e-310

    1. Initial program 31.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. 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 1.73062623171225e-310 < x.re

    1. Initial program 35.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)\]
    2. Taylor expanded around inf 24.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 \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)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.1

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

Reproduce

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