Average Error: 31.1 → 0.2
Time: 3.8m
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)\]
\[\frac{\sin \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\sqrt{x.re^2 + x.im^2}^*\right)}}\]
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)
\frac{\sin \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\sqrt{x.re^2 + x.im^2}^*\right)}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r353544 = x_re;
        double r353545 = r353544 * r353544;
        double r353546 = x_im;
        double r353547 = r353546 * r353546;
        double r353548 = r353545 + r353547;
        double r353549 = sqrt(r353548);
        double r353550 = log(r353549);
        double r353551 = y_re;
        double r353552 = r353550 * r353551;
        double r353553 = atan2(r353546, r353544);
        double r353554 = y_im;
        double r353555 = r353553 * r353554;
        double r353556 = r353552 - r353555;
        double r353557 = exp(r353556);
        double r353558 = r353550 * r353554;
        double r353559 = r353553 * r353551;
        double r353560 = r353558 + r353559;
        double r353561 = sin(r353560);
        double r353562 = r353557 * r353561;
        return r353562;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r353563 = y_im;
        double r353564 = x_re;
        double r353565 = x_im;
        double r353566 = hypot(r353564, r353565);
        double r353567 = log(r353566);
        double r353568 = atan2(r353565, r353564);
        double r353569 = y_re;
        double r353570 = r353568 * r353569;
        double r353571 = fma(r353563, r353567, r353570);
        double r353572 = sin(r353571);
        double r353573 = r353568 * r353563;
        double r353574 = r353569 * r353567;
        double r353575 = r353573 - r353574;
        double r353576 = exp(r353575);
        double r353577 = r353572 / r353576;
        return r353577;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Derivation

  1. Initial program 31.1

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

    \[\leadsto \color{blue}{\frac{\sin \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\sqrt{x.re^2 + x.im^2}^*\right)}}}\]
  3. Final simplification0.2

    \[\leadsto \frac{\sin \left((y.im \cdot \left(\log \left(\sqrt{x.re^2 + x.im^2}^*\right)\right) + \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right))_*\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\sqrt{x.re^2 + x.im^2}^*\right)}}\]

Reproduce

herbie shell --seed 2019119 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, imaginary part"
  (* (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)))))