Average Error: 33.5 → 4.0
Time: 34.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)\]
\[\frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{\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)} \cdot \left(\sqrt[3]{\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)} \cdot \sqrt[3]{\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)\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{\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{\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)} \cdot \left(\sqrt[3]{\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)} \cdot \sqrt[3]{\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)\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 r1039370 = x_re;
        double r1039371 = r1039370 * r1039370;
        double r1039372 = x_im;
        double r1039373 = r1039372 * r1039372;
        double r1039374 = r1039371 + r1039373;
        double r1039375 = sqrt(r1039374);
        double r1039376 = log(r1039375);
        double r1039377 = y_re;
        double r1039378 = r1039376 * r1039377;
        double r1039379 = atan2(r1039372, r1039370);
        double r1039380 = y_im;
        double r1039381 = r1039379 * r1039380;
        double r1039382 = r1039378 - r1039381;
        double r1039383 = exp(r1039382);
        double r1039384 = r1039376 * r1039380;
        double r1039385 = r1039379 * r1039377;
        double r1039386 = r1039384 + r1039385;
        double r1039387 = sin(r1039386);
        double r1039388 = r1039383 * r1039387;
        return r1039388;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1039389 = y_im;
        double r1039390 = x_re;
        double r1039391 = x_im;
        double r1039392 = hypot(r1039390, r1039391);
        double r1039393 = log(r1039392);
        double r1039394 = atan2(r1039391, r1039390);
        double r1039395 = y_re;
        double r1039396 = r1039394 * r1039395;
        double r1039397 = fma(r1039389, r1039393, r1039396);
        double r1039398 = sin(r1039397);
        double r1039399 = cbrt(r1039398);
        double r1039400 = r1039399 * r1039399;
        double r1039401 = r1039399 * r1039400;
        double r1039402 = log1p(r1039401);
        double r1039403 = expm1(r1039402);
        double r1039404 = expm1(r1039403);
        double r1039405 = log1p(r1039404);
        double r1039406 = r1039394 * r1039389;
        double r1039407 = r1039395 * r1039393;
        double r1039408 = r1039406 - r1039407;
        double r1039409 = exp(r1039408);
        double r1039410 = r1039405 / r1039409;
        return r1039410;
}

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

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

    \[\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 log1p-expm1-u3.6

    \[\leadsto \frac{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\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^{\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 expm1-log1p-u3.6

    \[\leadsto \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\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)}\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)}}\]
  7. Using strategy rm
  8. Applied add-cube-cbrt4.0

    \[\leadsto \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(\sqrt[3]{\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)} \cdot \sqrt[3]{\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) \cdot \sqrt[3]{\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)\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)}}\]
  9. Final simplification4.0

    \[\leadsto \frac{\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sqrt[3]{\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)} \cdot \left(\sqrt[3]{\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)} \cdot \sqrt[3]{\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)\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 2019170 +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)))))