Average Error: 33.6 → 22.8
Time: 31.7s
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.749560127864620493100861011759863262377 \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(-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 + \log x.re \cdot y.im\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.749560127864620493100861011759863262377 \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(-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 + \log x.re \cdot y.im\right)\\

\end{array}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r27263 = x_re;
        double r27264 = r27263 * r27263;
        double r27265 = x_im;
        double r27266 = r27265 * r27265;
        double r27267 = r27264 + r27266;
        double r27268 = sqrt(r27267);
        double r27269 = log(r27268);
        double r27270 = y_re;
        double r27271 = r27269 * r27270;
        double r27272 = atan2(r27265, r27263);
        double r27273 = y_im;
        double r27274 = r27272 * r27273;
        double r27275 = r27271 - r27274;
        double r27276 = exp(r27275);
        double r27277 = r27269 * r27273;
        double r27278 = r27272 * r27270;
        double r27279 = r27277 + r27278;
        double r27280 = sin(r27279);
        double r27281 = r27276 * r27280;
        return r27281;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r27282 = x_re;
        double r27283 = -8.7495601278646e-311;
        bool r27284 = r27282 <= r27283;
        double r27285 = r27282 * r27282;
        double r27286 = x_im;
        double r27287 = r27286 * r27286;
        double r27288 = r27285 + r27287;
        double r27289 = sqrt(r27288);
        double r27290 = log(r27289);
        double r27291 = y_re;
        double r27292 = r27290 * r27291;
        double r27293 = atan2(r27286, r27282);
        double r27294 = y_im;
        double r27295 = r27293 * r27294;
        double r27296 = r27292 - r27295;
        double r27297 = exp(r27296);
        double r27298 = -r27282;
        double r27299 = log(r27298);
        double r27300 = r27299 * r27294;
        double r27301 = r27293 * r27291;
        double r27302 = r27300 + r27301;
        double r27303 = sin(r27302);
        double r27304 = r27297 * r27303;
        double r27305 = log(r27282);
        double r27306 = r27305 * r27294;
        double r27307 = r27301 + r27306;
        double r27308 = sin(r27307);
        double r27309 = r27297 * r27308;
        double r27310 = r27284 ? r27304 : r27309;
        return r27310;
}

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.7495601278646e-311

    1. Initial program 32.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 20.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}{\left(-1 \cdot x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
    3. Simplified20.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}{\left(-x.re\right)} \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]

    if -8.7495601278646e-311 < x.re

    1. Initial program 35.3

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

      \[\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. Simplified24.7

      \[\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 + \log x.re \cdot y.im\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification22.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x.re \le -8.749560127864620493100861011759863262377 \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(-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 + \log x.re \cdot y.im\right)\\ \end{array}\]

Reproduce

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