Average Error: 32.7 → 3.4
Time: 32.8s
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{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)}{e^{\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)\right) \cdot \sqrt[3]{\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{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)}{e^{\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)\right) \cdot \sqrt[3]{\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 r1175415 = x_re;
        double r1175416 = r1175415 * r1175415;
        double r1175417 = x_im;
        double r1175418 = r1175417 * r1175417;
        double r1175419 = r1175416 + r1175418;
        double r1175420 = sqrt(r1175419);
        double r1175421 = log(r1175420);
        double r1175422 = y_re;
        double r1175423 = r1175421 * r1175422;
        double r1175424 = atan2(r1175417, r1175415);
        double r1175425 = y_im;
        double r1175426 = r1175424 * r1175425;
        double r1175427 = r1175423 - r1175426;
        double r1175428 = exp(r1175427);
        double r1175429 = r1175421 * r1175425;
        double r1175430 = r1175424 * r1175422;
        double r1175431 = r1175429 + r1175430;
        double r1175432 = sin(r1175431);
        double r1175433 = r1175428 * r1175432;
        return r1175433;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1175434 = y_im;
        double r1175435 = x_re;
        double r1175436 = x_im;
        double r1175437 = hypot(r1175435, r1175436);
        double r1175438 = log(r1175437);
        double r1175439 = atan2(r1175436, r1175435);
        double r1175440 = y_re;
        double r1175441 = r1175439 * r1175440;
        double r1175442 = fma(r1175434, r1175438, r1175441);
        double r1175443 = sin(r1175442);
        double r1175444 = log1p(r1175443);
        double r1175445 = expm1(r1175444);
        double r1175446 = r1175439 * r1175434;
        double r1175447 = cbrt(r1175446);
        double r1175448 = cbrt(r1175447);
        double r1175449 = r1175448 * r1175448;
        double r1175450 = r1175449 * r1175448;
        double r1175451 = r1175447 * r1175450;
        double r1175452 = r1175451 * r1175447;
        double r1175453 = r1175440 * r1175438;
        double r1175454 = r1175452 - r1175453;
        double r1175455 = exp(r1175454);
        double r1175456 = r1175445 / r1175455;
        return r1175456;
}

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 32.7

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

    \[\leadsto \color{blue}{\frac{\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^{\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. Using strategy rm
  4. Applied add-cube-cbrt3.4

    \[\leadsto \frac{\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^{\color{blue}{\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}\]
  5. Using strategy rm
  6. Applied add-cube-cbrt3.4

    \[\leadsto \frac{\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^{\left(\color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}\]
  7. Using strategy rm
  8. Applied expm1-log1p-u3.4

    \[\leadsto \frac{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)}}{e^{\left(\left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}\]
  9. Final simplification3.4

    \[\leadsto \frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\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)\right)\right)}{e^{\left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \left(\left(\sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}} \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right) \cdot \sqrt[3]{\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}}\right)\right) \cdot \sqrt[3]{\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 2019172 +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)))))