Average Error: 33.2 → 3.5
Time: 28.1s
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^{\left(y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\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)\]
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^{\left(y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\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)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r520371 = x_re;
        double r520372 = r520371 * r520371;
        double r520373 = x_im;
        double r520374 = r520373 * r520373;
        double r520375 = r520372 + r520374;
        double r520376 = sqrt(r520375);
        double r520377 = log(r520376);
        double r520378 = y_re;
        double r520379 = r520377 * r520378;
        double r520380 = atan2(r520373, r520371);
        double r520381 = y_im;
        double r520382 = r520380 * r520381;
        double r520383 = r520379 - r520382;
        double r520384 = exp(r520383);
        double r520385 = r520377 * r520381;
        double r520386 = r520380 * r520378;
        double r520387 = r520385 + r520386;
        double r520388 = sin(r520387);
        double r520389 = r520384 * r520388;
        return r520389;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r520390 = y_re;
        double r520391 = x_re;
        double r520392 = x_im;
        double r520393 = hypot(r520391, r520392);
        double r520394 = cbrt(r520393);
        double r520395 = log(r520394);
        double r520396 = r520390 * r520395;
        double r520397 = r520394 * r520394;
        double r520398 = log(r520397);
        double r520399 = r520390 * r520398;
        double r520400 = r520396 + r520399;
        double r520401 = atan2(r520392, r520391);
        double r520402 = y_im;
        double r520403 = r520401 * r520402;
        double r520404 = r520400 - r520403;
        double r520405 = exp(r520404);
        double r520406 = log(r520393);
        double r520407 = r520401 * r520390;
        double r520408 = fma(r520402, r520406, r520407);
        double r520409 = sin(r520408);
        double r520410 = r520405 * r520409;
        return r520410;
}

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 33.2

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

    \[\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. Using strategy rm
  4. Applied add-cube-cbrt3.5

    \[\leadsto e^{y.re \cdot \log \color{blue}{\left(\left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) \cdot \sqrt[3]{\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)\]
  5. Applied log-prod3.5

    \[\leadsto e^{y.re \cdot \color{blue}{\left(\log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\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)\]
  6. Applied distribute-lft-in3.5

    \[\leadsto e^{\color{blue}{\left(y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\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)\]
  7. Final simplification3.5

    \[\leadsto e^{\left(y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\right) + y.re \cdot \log \left(\sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)} \cdot \sqrt[3]{\mathsf{hypot}\left(x.re, x.im\right)}\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)\]

Reproduce

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