Average Error: 0.0 → 0.0
Time: 12.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{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 r10226 = xre;
        double r10227 = xim;
        double r10228 = /* ERROR: no complex support in C */;
        double r10229 = exp(r10228);
        double r10230 = -r10228;
        double r10231 = exp(r10230);
        double r10232 = r10229 + r10231;
        double r10233 = 2.0;
        double r10234 = 0.0;
        double r10235 = /* ERROR: no complex support in C */;
        double r10236 = r10232 / r10235;
        double r10237 = /* ERROR: no complex support in C */;
        return r10237;
}

double f(double xre, double xim) {
        double r10238 = xre;
        double r10239 = xim;
        double r10240 = /* ERROR: no complex support in C */;
        double r10241 = -r10240;
        double r10242 = exp(r10241);
        double r10243 = exp(r10240);
        double r10244 = r10242 + r10243;
        double r10245 = 2.0;
        double r10246 = 0.0;
        double r10247 = /* ERROR: no complex support in C */;
        double r10248 = r10244 / r10247;
        double r10249 = /* ERROR: no complex support in C */;
        return r10249;
}

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