Average Error: 33.8 → 4.1
Time: 6.8s
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(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \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 \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(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \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 r14240 = x_re;
        double r14241 = r14240 * r14240;
        double r14242 = x_im;
        double r14243 = r14242 * r14242;
        double r14244 = r14241 + r14243;
        double r14245 = sqrt(r14244);
        double r14246 = log(r14245);
        double r14247 = y_re;
        double r14248 = r14246 * r14247;
        double r14249 = atan2(r14242, r14240);
        double r14250 = y_im;
        double r14251 = r14249 * r14250;
        double r14252 = r14248 - r14251;
        double r14253 = exp(r14252);
        double r14254 = r14246 * r14250;
        double r14255 = r14249 * r14247;
        double r14256 = r14254 + r14255;
        double r14257 = cos(r14256);
        double r14258 = r14253 * r14257;
        return r14258;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r14259 = x_re;
        double r14260 = x_im;
        double r14261 = hypot(r14259, r14260);
        double r14262 = log(r14261);
        double r14263 = y_re;
        double r14264 = r14262 * r14263;
        double r14265 = atan2(r14260, r14259);
        double r14266 = y_im;
        double r14267 = r14265 * r14266;
        double r14268 = r14264 - r14267;
        double r14269 = exp(r14268);
        return r14269;
}

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

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

    \[\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 hypot-def4.1

    \[\leadsto e^{\log \color{blue}{\left(\mathsf{hypot}\left(x.re, x.im\right)\right)} \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im} \cdot 1\]
  5. Final simplification4.1

    \[\leadsto e^{\log \left(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - \tan^{-1}_* \frac{x.im}{x.re} \cdot y.im}\]

Reproduce

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