Average Error: 0.0 → 0.0
Time: 12.1s
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 r10213 = xre;
        double r10214 = xim;
        double r10215 = /* ERROR: no complex support in C */;
        double r10216 = exp(r10215);
        double r10217 = -r10215;
        double r10218 = exp(r10217);
        double r10219 = r10216 + r10218;
        double r10220 = 2.0;
        double r10221 = 0.0;
        double r10222 = /* ERROR: no complex support in C */;
        double r10223 = r10219 / r10222;
        double r10224 = /* ERROR: no complex support in C */;
        return r10224;
}

double f(double xre, double xim) {
        double r10225 = xre;
        double r10226 = xim;
        double r10227 = /* ERROR: no complex support in C */;
        double r10228 = -r10227;
        double r10229 = exp(r10228);
        double r10230 = exp(r10227);
        double r10231 = r10229 + r10230;
        double r10232 = 2.0;
        double r10233 = 0.0;
        double r10234 = /* ERROR: no complex support in C */;
        double r10235 = r10231 / r10234;
        double r10236 = /* ERROR: no complex support in C */;
        return r10236;
}

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