Average Error: 0.0 → 0.0
Time: 3.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.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.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.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.0 i\right)}\right))
double f(double xre, double xim) {
        double r13241 = xre;
        double r13242 = xim;
        double r13243 = /* ERROR: no complex support in C */;
        double r13244 = exp(r13243);
        double r13245 = -r13243;
        double r13246 = exp(r13245);
        double r13247 = r13244 + r13246;
        double r13248 = 2.0;
        double r13249 = 0.0;
        double r13250 = /* ERROR: no complex support in C */;
        double r13251 = r13247 / r13250;
        double r13252 = /* ERROR: no complex support in C */;
        return r13252;
}

double f(double xre, double xim) {
        double r13253 = xre;
        double r13254 = xim;
        double r13255 = /* ERROR: no complex support in C */;
        double r13256 = exp(r13255);
        double r13257 = -r13255;
        double r13258 = exp(r13257);
        double r13259 = r13256 + r13258;
        double r13260 = 2.0;
        double r13261 = 0.0;
        double r13262 = /* ERROR: no complex support in C */;
        double r13263 = r13259 / r13262;
        double r13264 = /* ERROR: no complex support in C */;
        return r13264;
}

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.0 i\right)}\right))\]
  2. Final simplification0.0

    \[\leadsto \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.0 i\right)}\right))\]

Reproduce

herbie shell --seed 2020083 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power real part (p55)"
  :precision binary64
  (re (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2 0.0))))