Average Error: 33.0 → 4.1
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)\]
\[\mathsf{expm1}\left(\mathsf{log1p}\left(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 y.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)
\mathsf{expm1}\left(\mathsf{log1p}\left(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 y.im}\right)\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r14560 = x_re;
        double r14561 = r14560 * r14560;
        double r14562 = x_im;
        double r14563 = r14562 * r14562;
        double r14564 = r14561 + r14563;
        double r14565 = sqrt(r14564);
        double r14566 = log(r14565);
        double r14567 = y_re;
        double r14568 = r14566 * r14567;
        double r14569 = atan2(r14562, r14560);
        double r14570 = y_im;
        double r14571 = r14569 * r14570;
        double r14572 = r14568 - r14571;
        double r14573 = exp(r14572);
        double r14574 = r14566 * r14570;
        double r14575 = r14569 * r14567;
        double r14576 = r14574 + r14575;
        double r14577 = cos(r14576);
        double r14578 = r14573 * r14577;
        return r14578;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r14579 = x_re;
        double r14580 = x_im;
        double r14581 = hypot(r14579, r14580);
        double r14582 = log(r14581);
        double r14583 = exp(r14582);
        double r14584 = log(r14583);
        double r14585 = y_re;
        double r14586 = r14584 * r14585;
        double r14587 = atan2(r14580, r14579);
        double r14588 = y_im;
        double r14589 = r14587 * r14588;
        double r14590 = r14586 - r14589;
        double r14591 = exp(r14590);
        double r14592 = log1p(r14591);
        double r14593 = expm1(r14592);
        return r14593;
}

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.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 \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. Taylor expanded around 0 19.9

    \[\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 \color{blue}{1}\]
  3. Using strategy rm
  4. Applied add-exp-log19.9

    \[\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 1\]
  5. Simplified4.1

    \[\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 1\]
  6. Using strategy rm
  7. Applied expm1-log1p-u4.1

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(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 y.im}\right)\right)} \cdot 1\]
  8. Final simplification4.1

    \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(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 y.im}\right)\right)\]

Reproduce

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