Average Error: 33.9 → 3.7
Time: 8.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 \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)\]
\[e^{\log \left(e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}\right) \cdot y.re - \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}} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\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)
e^{\log \left(e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}\right) \cdot y.re - \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}} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\right)\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r14476 = x_re;
        double r14477 = r14476 * r14476;
        double r14478 = x_im;
        double r14479 = r14478 * r14478;
        double r14480 = r14477 + r14479;
        double r14481 = sqrt(r14480);
        double r14482 = log(r14481);
        double r14483 = y_re;
        double r14484 = r14482 * r14483;
        double r14485 = atan2(r14478, r14476);
        double r14486 = y_im;
        double r14487 = r14485 * r14486;
        double r14488 = r14484 - r14487;
        double r14489 = exp(r14488);
        double r14490 = r14482 * r14486;
        double r14491 = r14485 * r14483;
        double r14492 = r14490 + r14491;
        double r14493 = cos(r14492);
        double r14494 = r14489 * r14493;
        return r14494;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r14495 = x_re;
        double r14496 = x_im;
        double r14497 = hypot(r14495, r14496);
        double r14498 = log(r14497);
        double r14499 = exp(r14498);
        double r14500 = log(r14499);
        double r14501 = y_re;
        double r14502 = r14500 * r14501;
        double r14503 = atan2(r14496, r14495);
        double r14504 = y_im;
        double r14505 = cbrt(r14504);
        double r14506 = r14505 * r14505;
        double r14507 = r14503 * r14506;
        double r14508 = r14507 * r14505;
        double r14509 = r14502 - r14508;
        double r14510 = exp(r14509);
        double r14511 = r14498 * r14504;
        double r14512 = r14503 * r14501;
        double r14513 = r14511 + r14512;
        double r14514 = cos(r14513);
        double r14515 = expm1(r14514);
        double r14516 = log1p(r14515);
        double r14517 = r14510 * r14516;
        return r14517;
}

Error

Bits error versus x.re

Bits error versus x.im

Bits error versus y.re

Bits error versus y.im

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 33.9

    \[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. Using strategy rm
  3. Applied hypot-def20.4

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

    \[\leadsto e^{\log \color{blue}{\left(e^{\log \left(\sqrt{x.re \cdot x.re + x.im \cdot x.im}\right)}\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
  6. Simplified3.7

    \[\leadsto e^{\log \left(e^{\color{blue}{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}}\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
  7. Using strategy rm
  8. Applied add-cube-cbrt3.7

    \[\leadsto e^{\log \left(e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right)}\right) \cdot y.re - \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)}} \cdot \cos \left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.im + \tan^{-1}_* \frac{x.im}{x.re} \cdot y.re\right)\]
  9. Applied associate-*r*3.7

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

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

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

Reproduce

herbie shell --seed 2019346 +o rules:numerics
(FPCore (x.re x.im y.re y.im)
  :name "powComplex, real part"
  :precision binary64
  (* (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)))))