Average Error: 30.8 → 0.1
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)\]
\[e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\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)
e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \sin \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r881375 = x_re;
        double r881376 = r881375 * r881375;
        double r881377 = x_im;
        double r881378 = r881377 * r881377;
        double r881379 = r881376 + r881378;
        double r881380 = sqrt(r881379);
        double r881381 = log(r881380);
        double r881382 = y_re;
        double r881383 = r881381 * r881382;
        double r881384 = atan2(r881377, r881375);
        double r881385 = y_im;
        double r881386 = r881384 * r881385;
        double r881387 = r881383 - r881386;
        double r881388 = exp(r881387);
        double r881389 = r881381 * r881385;
        double r881390 = r881384 * r881382;
        double r881391 = r881389 + r881390;
        double r881392 = sin(r881391);
        double r881393 = r881388 * r881392;
        return r881393;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r881394 = x_re;
        double r881395 = x_im;
        double r881396 = hypot(r881394, r881395);
        double r881397 = log(r881396);
        double r881398 = y_re;
        double r881399 = r881397 * r881398;
        double r881400 = y_im;
        double r881401 = atan2(r881395, r881394);
        double r881402 = r881400 * r881401;
        double r881403 = r881399 - r881402;
        double r881404 = exp(r881403);
        double r881405 = r881398 * r881401;
        double r881406 = fma(r881400, r881397, r881405);
        double r881407 = sin(r881406);
        double r881408 = r881404 * r881407;
        return r881408;
}

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.1

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

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

Reproduce

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