Average Error: 0.0 → 0.0
Time: 12.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 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 r10274 = xre;
        double r10275 = xim;
        double r10276 = /* ERROR: no complex support in C */;
        double r10277 = exp(r10276);
        double r10278 = -r10276;
        double r10279 = exp(r10278);
        double r10280 = r10277 + r10279;
        double r10281 = 2.0;
        double r10282 = 0.0;
        double r10283 = /* ERROR: no complex support in C */;
        double r10284 = r10280 / r10283;
        double r10285 = /* ERROR: no complex support in C */;
        return r10285;
}

double f(double xre, double xim) {
        double r10286 = xre;
        double r10287 = xim;
        double r10288 = /* ERROR: no complex support in C */;
        double r10289 = -r10288;
        double r10290 = exp(r10289);
        double r10291 = exp(r10288);
        double r10292 = r10290 + r10291;
        double r10293 = 2.0;
        double r10294 = 0.0;
        double r10295 = /* ERROR: no complex support in C */;
        double r10296 = r10292 / r10295;
        double r10297 = /* ERROR: no complex support in C */;
        return r10297;
}

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