Average Error: 0.0 → 0.0
Time: 13.0s
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 r10249 = xre;
        double r10250 = xim;
        double r10251 = /* ERROR: no complex support in C */;
        double r10252 = exp(r10251);
        double r10253 = -r10251;
        double r10254 = exp(r10253);
        double r10255 = r10252 + r10254;
        double r10256 = 2.0;
        double r10257 = 0.0;
        double r10258 = /* ERROR: no complex support in C */;
        double r10259 = r10255 / r10258;
        double r10260 = /* ERROR: no complex support in C */;
        return r10260;
}

double f(double xre, double xim) {
        double r10261 = xre;
        double r10262 = xim;
        double r10263 = /* ERROR: no complex support in C */;
        double r10264 = -r10263;
        double r10265 = exp(r10264);
        double r10266 = exp(r10263);
        double r10267 = r10265 + r10266;
        double r10268 = 2.0;
        double r10269 = 0.0;
        double r10270 = /* ERROR: no complex support in C */;
        double r10271 = r10267 / r10270;
        double r10272 = /* ERROR: no complex support in C */;
        return r10272;
}

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