Average Error: 33.0 → 3.5
Time: 26.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)\]
\[\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right)\right)\right)\right)\right)\right) \cdot 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}\]
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)
\mathsf{log1p}\left(\mathsf{expm1}\left(\mathsf{expm1}\left(\mathsf{log1p}\left(\sin \left(\mathsf{fma}\left(\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.im, \left(\sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re} \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right) \cdot \sqrt[3]{\tan^{-1}_* \frac{x.im}{x.re} \cdot y.re}\right)\right)\right)\right)\right)\right) \cdot 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}
double f(double x_re, double x_im, double y_re, double y_im) {
        double r1691565 = x_re;
        double r1691566 = r1691565 * r1691565;
        double r1691567 = x_im;
        double r1691568 = r1691567 * r1691567;
        double r1691569 = r1691566 + r1691568;
        double r1691570 = sqrt(r1691569);
        double r1691571 = log(r1691570);
        double r1691572 = y_re;
        double r1691573 = r1691571 * r1691572;
        double r1691574 = atan2(r1691567, r1691565);
        double r1691575 = y_im;
        double r1691576 = r1691574 * r1691575;
        double r1691577 = r1691573 - r1691576;
        double r1691578 = exp(r1691577);
        double r1691579 = r1691571 * r1691575;
        double r1691580 = r1691574 * r1691572;
        double r1691581 = r1691579 + r1691580;
        double r1691582 = sin(r1691581);
        double r1691583 = r1691578 * r1691582;
        return r1691583;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r1691584 = x_re;
        double r1691585 = x_im;
        double r1691586 = hypot(r1691584, r1691585);
        double r1691587 = log(r1691586);
        double r1691588 = y_im;
        double r1691589 = atan2(r1691585, r1691584);
        double r1691590 = y_re;
        double r1691591 = r1691589 * r1691590;
        double r1691592 = cbrt(r1691591);
        double r1691593 = r1691592 * r1691592;
        double r1691594 = r1691593 * r1691592;
        double r1691595 = fma(r1691587, r1691588, r1691594);
        double r1691596 = sin(r1691595);
        double r1691597 = log1p(r1691596);
        double r1691598 = expm1(r1691597);
        double r1691599 = expm1(r1691598);
        double r1691600 = log1p(r1691599);
        double r1691601 = r1691590 * r1691587;
        double r1691602 = r1691589 * r1691588;
        double r1691603 = r1691601 - r1691602;
        double r1691604 = exp(r1691603);
        double r1691605 = r1691600 * r1691604;
        return r1691605;
}

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

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

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

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

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

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

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

Reproduce

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