Average Error: 0.0 → 0.0
Time: 13.3s
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 r10430 = xre;
        double r10431 = xim;
        double r10432 = /* ERROR: no complex support in C */;
        double r10433 = exp(r10432);
        double r10434 = -r10432;
        double r10435 = exp(r10434);
        double r10436 = r10433 + r10435;
        double r10437 = 2.0;
        double r10438 = 0.0;
        double r10439 = /* ERROR: no complex support in C */;
        double r10440 = r10436 / r10439;
        double r10441 = /* ERROR: no complex support in C */;
        return r10441;
}

double f(double xre, double xim) {
        double r10442 = xre;
        double r10443 = xim;
        double r10444 = /* ERROR: no complex support in C */;
        double r10445 = -r10444;
        double r10446 = exp(r10445);
        double r10447 = exp(r10444);
        double r10448 = r10446 + r10447;
        double r10449 = 2.0;
        double r10450 = 0.0;
        double r10451 = /* ERROR: no complex support in C */;
        double r10452 = r10448 / r10451;
        double r10453 = /* ERROR: no complex support in C */;
        return r10453;
}

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 2019156 +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))))