Average Error: 0.0 → 0.0
Time: 16.8s
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 + 0.0 i\right)}\right))\]
\[\Re(\left(\frac{\left(\left(e^{\left(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2.0 + 0.0 i\right)}\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 + 0.0 i\right)}\right))
\Re(\left(\frac{\left(\left(e^{\left(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2.0 + 0.0 i\right)}\right))
double f(double xre, double xim) {
        double r10388 = xre;
        double r10389 = xim;
        double r10390 = /* ERROR: no complex support in C */;
        double r10391 = exp(r10390);
        double r10392 = -r10390;
        double r10393 = exp(r10392);
        double r10394 = r10391 + r10393;
        double r10395 = 2.0;
        double r10396 = 0.0;
        double r10397 = /* ERROR: no complex support in C */;
        double r10398 = r10394 / r10397;
        double r10399 = /* ERROR: no complex support in C */;
        return r10399;
}

double f(double xre, double xim) {
        double r10400 = xre;
        double r10401 = xim;
        double r10402 = /* ERROR: no complex support in C */;
        double r10403 = -r10402;
        double r10404 = exp(r10403);
        double r10405 = exp(r10402);
        double r10406 = r10404 + r10405;
        double r10407 = 2.0;
        double r10408 = 0.0;
        double r10409 = /* ERROR: no complex support in C */;
        double r10410 = r10406 / r10409;
        double r10411 = /* ERROR: no complex support in C */;
        return r10411;
}

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 + 0.0 i\right)}\right))\]
  2. Final simplification0.0

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

Reproduce

herbie shell --seed 2019165 
(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 0.0))))