Average Error: 0.0 → 0.0
Time: 13.1s
Precision: 64
\[\Re(\left(\frac{\left(\left(e^{\left(xre + xim i\right)}\right) + \left(e^{\left(-\left(xre + xim i\right)\right)}\right)\right)}{\left(2 + 0 i\right)}\right))\]
\[\Re(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))\]
\Re(\left(\frac{\left(\left(e^{\left(xre + xim i\right)}\right) + \left(e^{\left(-\left(xre + xim i\right)\right)}\right)\right)}{\left(2 + 0 i\right)}\right))
\Re(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))
double f(double xre, double xim) {
        double r10313 = xre;
        double r10314 = xim;
        double r10315 = /* ERROR: no complex support in C */;
        double r10316 = exp(r10315);
        double r10317 = -r10315;
        double r10318 = exp(r10317);
        double r10319 = r10316 + r10318;
        double r10320 = 2.0;
        double r10321 = 0.0;
        double r10322 = /* ERROR: no complex support in C */;
        double r10323 = r10319 / r10322;
        double r10324 = /* ERROR: no complex support in C */;
        return r10324;
}

double f(double xre, double xim) {
        double r10325 = xre;
        double r10326 = xim;
        double r10327 = /* ERROR: no complex support in C */;
        double r10328 = -r10327;
        double r10329 = exp(r10328);
        double r10330 = exp(r10327);
        double r10331 = r10329 + r10330;
        double r10332 = 2.0;
        double r10333 = 0.0;
        double r10334 = /* ERROR: no complex support in C */;
        double r10335 = r10331 / r10334;
        double r10336 = /* ERROR: no complex support in C */;
        return r10336;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 0.0

    \[\Re(\left(\frac{\left(\left(e^{\left(xre + xim i\right)}\right) + \left(e^{\left(-\left(xre + xim i\right)\right)}\right)\right)}{\left(2 + 0 i\right)}\right))\]
  2. Final simplification0.0

    \[\leadsto \Re(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))\]

Reproduce

herbie shell --seed 2019149 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power real part (p55)"
  (re (/.c (+.c (exp.c (complex xre xim)) (exp.c (neg.c (complex xre xim)))) (complex 2 0))))