Average Error: 33.4 → 3.5
Time: 54.6s
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 \cos \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(\cos \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^{\sqrt[3]{y.im} \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)\right) - 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 \cos \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(\cos \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^{\sqrt[3]{y.im} \cdot \left(\tan^{-1}_* \frac{x.im}{x.re} \cdot \left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right)\right) - 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 r1394334 = x_re;
        double r1394335 = r1394334 * r1394334;
        double r1394336 = x_im;
        double r1394337 = r1394336 * r1394336;
        double r1394338 = r1394335 + r1394337;
        double r1394339 = sqrt(r1394338);
        double r1394340 = log(r1394339);
        double r1394341 = y_re;
        double r1394342 = r1394340 * r1394341;
        double r1394343 = atan2(r1394336, r1394334);
        double r1394344 = y_im;
        double r1394345 = r1394343 * r1394344;
        double r1394346 = r1394342 - r1394345;
        double r1394347 = exp(r1394346);
        double r1394348 = r1394340 * r1394344;
        double r1394349 = r1394343 * r1394341;
        double r1394350 = r1394348 + r1394349;
        double r1394351 = cos(r1394350);
        double r1394352 = r1394347 * r1394351;
        return r1394352;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1394353 = y_im;
        double r1394354 = x_re;
        double r1394355 = x_im;
        double r1394356 = hypot(r1394354, r1394355);
        double r1394357 = log(r1394356);
        double r1394358 = atan2(r1394355, r1394354);
        double r1394359 = y_re;
        double r1394360 = r1394358 * r1394359;
        double r1394361 = fma(r1394353, r1394357, r1394360);
        double r1394362 = cos(r1394361);
        double r1394363 = log1p(r1394362);
        double r1394364 = expm1(r1394363);
        double r1394365 = cbrt(r1394353);
        double r1394366 = r1394365 * r1394365;
        double r1394367 = r1394358 * r1394366;
        double r1394368 = r1394365 * r1394367;
        double r1394369 = r1394359 * r1394357;
        double r1394370 = r1394368 - r1394369;
        double r1394371 = exp(r1394370);
        double r1394372 = r1394364 / r1394371;
        return r1394372;
}

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

    \[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 \cos \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}{\frac{\cos \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.5

    \[\leadsto \frac{\cos \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 \color{blue}{\left(\left(\sqrt[3]{y.im} \cdot \sqrt[3]{y.im}\right) \cdot \sqrt[3]{y.im}\right)} - y.re \cdot \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}\]
  5. Applied associate-*r*3.5

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

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

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

Reproduce

herbie shell --seed 2019168 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  (* (exp (- (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.re) (* (atan2 x.im x.re) y.im))) (cos (+ (* (log (sqrt (+ (* x.re x.re) (* x.im x.im)))) y.im) (* (atan2 x.im x.re) y.re)))))