Average Error: 0.0 → 0.0
Time: 13.5s
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{\left(\left(e^{\left(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 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 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 i\right)}\right))
double f(double xre, double xim) {
        double r10265 = xre;
        double r10266 = xim;
        double r10267 = /* ERROR: no complex support in C */;
        double r10268 = exp(r10267);
        double r10269 = -r10267;
        double r10270 = exp(r10269);
        double r10271 = r10268 + r10270;
        double r10272 = 2.0;
        double r10273 = 0.0;
        double r10274 = /* ERROR: no complex support in C */;
        double r10275 = r10271 / r10274;
        double r10276 = /* ERROR: no complex support in C */;
        return r10276;
}

double f(double xre, double xim) {
        double r10277 = xre;
        double r10278 = xim;
        double r10279 = /* ERROR: no complex support in C */;
        double r10280 = -r10279;
        double r10281 = exp(r10280);
        double r10282 = exp(r10279);
        double r10283 = r10281 + r10282;
        double r10284 = 2.0;
        double r10285 = 0.0;
        double r10286 = /* ERROR: no complex support in C */;
        double r10287 = r10283 / r10286;
        double r10288 = /* ERROR: no complex support in C */;
        return r10288;
}

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{\left(\left(e^{\left(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0 i\right)}\right))\]

Reproduce

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