Average Error: 33.0 → 4.0
Time: 32.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(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \log \left(e^{\left(\left(\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\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(\mathsf{hypot}\left(x.re, x.im\right)\right) \cdot y.re - y.im \cdot \tan^{-1}_* \frac{x.im}{x.re}} \cdot \log \left(e^{\left(\left(\cos \left(\mathsf{fma}\left(y.im, \log \left(\mathsf{hypot}\left(x.re, x.im\right)\right), y.re \cdot \tan^{-1}_* \frac{x.im}{x.re}\right)\right)\right)\right)}\right)
double f(double x_re, double x_im, double y_re, double y_im) {
        double r566347 = x_re;
        double r566348 = r566347 * r566347;
        double r566349 = x_im;
        double r566350 = r566349 * r566349;
        double r566351 = r566348 + r566350;
        double r566352 = sqrt(r566351);
        double r566353 = log(r566352);
        double r566354 = y_re;
        double r566355 = r566353 * r566354;
        double r566356 = atan2(r566349, r566347);
        double r566357 = y_im;
        double r566358 = r566356 * r566357;
        double r566359 = r566355 - r566358;
        double r566360 = exp(r566359);
        double r566361 = r566353 * r566357;
        double r566362 = r566356 * r566354;
        double r566363 = r566361 + r566362;
        double r566364 = cos(r566363);
        double r566365 = r566360 * r566364;
        return r566365;
}

double f(double x_re, double x_im, double y_re, double y_im) {
        double r566366 = x_re;
        double r566367 = x_im;
        double r566368 = hypot(r566366, r566367);
        double r566369 = log(r566368);
        double r566370 = y_re;
        double r566371 = r566369 * r566370;
        double r566372 = y_im;
        double r566373 = atan2(r566367, r566366);
        double r566374 = r566372 * r566373;
        double r566375 = r566371 - r566374;
        double r566376 = exp(r566375);
        double r566377 = r566370 * r566373;
        double r566378 = fma(r566372, r566369, r566377);
        double r566379 = cos(r566378);
        double r566380 = /* ERROR: no posit support in C */;
        double r566381 = /* ERROR: no posit support in C */;
        double r566382 = exp(r566381);
        double r566383 = log(r566382);
        double r566384 = r566376 * r566383;
        return r566384;
}

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

    \[\leadsto \color{blue}{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} \cdot \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)}\]
  3. Using strategy rm
  4. Applied insert-posit164.0

    \[\leadsto 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} \cdot \color{blue}{\left(\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)}\]
  5. Using strategy rm
  6. Applied add-log-exp4.0

    \[\leadsto 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} \cdot \color{blue}{\log \left(e^{\left(\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)}\right)}\]
  7. Final simplification4.0

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

Reproduce

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