Average Error: 30.8 → 0.2
Time: 3.9m
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(\mathsf{fma}\left(y.im, \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right), \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\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(\mathsf{fma}\left(y.im, \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right), \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r362308 = x_re;
        double r362309 = r362308 * r362308;
        double r362310 = x_im;
        double r362311 = r362310 * r362310;
        double r362312 = r362309 + r362311;
        double r362313 = sqrt(r362312);
        double r362314 = log(r362313);
        double r362315 = y_re;
        double r362316 = r362314 * r362315;
        double r362317 = atan2(r362310, r362308);
        double r362318 = y_im;
        double r362319 = r362317 * r362318;
        double r362320 = r362316 - r362319;
        double r362321 = exp(r362320);
        double r362322 = r362314 * r362318;
        double r362323 = r362317 * r362315;
        double r362324 = r362322 + r362323;
        double r362325 = sin(r362324);
        double r362326 = r362321 * r362325;
        return r362326;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r362327 = y_im;
        double r362328 = x_re;
        double r362329 = x_im;
        double r362330 = hypot(r362328, r362329);
        double r362331 = log(r362330);
        double r362332 = atan2(r362329, r362328);
        double r362333 = y_re;
        double r362334 = r362332 * r362333;
        double r362335 = fma(r362327, r362331, r362334);
        double r362336 = sin(r362335);
        double r362337 = r362332 * r362327;
        double r362338 = r362333 * r362331;
        double r362339 = r362337 - r362338;
        double r362340 = exp(r362339);
        double r362341 = r362336 / r362340;
        return r362341;
}

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 30.8

    \[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(\mathsf{fma}\left(y.im, \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right), \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}}\]
  3. Final simplification0.2

    \[\leadsto \frac{\sin \left(\mathsf{fma}\left(y.im, \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)\right), \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)}{e^{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}\]

Reproduce

herbie shell --seed 2019107 +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)))))