Average Error: 0.0 → 0.0
Time: 4.7s
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 r13225 = xre;
        double r13226 = xim;
        double r13227 = /* ERROR: no complex support in C */;
        double r13228 = exp(r13227);
        double r13229 = -r13227;
        double r13230 = exp(r13229);
        double r13231 = r13228 + r13230;
        double r13232 = 2.0;
        double r13233 = 0.0;
        double r13234 = /* ERROR: no complex support in C */;
        double r13235 = r13231 / r13234;
        double r13236 = /* ERROR: no complex support in C */;
        return r13236;
}

double f(double xre, double xim) {
        double r13237 = xre;
        double r13238 = xim;
        double r13239 = /* ERROR: no complex support in C */;
        double r13240 = exp(r13239);
        double r13241 = -r13239;
        double r13242 = exp(r13241);
        double r13243 = r13240 + r13242;
        double r13244 = 2.0;
        double r13245 = 0.0;
        double r13246 = /* ERROR: no complex support in C */;
        double r13247 = r13243 / r13246;
        double r13248 = /* ERROR: no complex support in C */;
        return r13248;
}

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