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 r12338 = xre;
        double r12339 = xim;
        double r12340 = /* ERROR: no complex support in C */;
        double r12341 = exp(r12340);
        double r12342 = -r12340;
        double r12343 = exp(r12342);
        double r12344 = r12341 + r12343;
        double r12345 = 2.0;
        double r12346 = 0.0;
        double r12347 = /* ERROR: no complex support in C */;
        double r12348 = r12344 / r12347;
        double r12349 = /* ERROR: no complex support in C */;
        return r12349;
}

double f(double xre, double xim) {
        double r12350 = xre;
        double r12351 = xim;
        double r12352 = /* ERROR: no complex support in C */;
        double r12353 = exp(r12352);
        double r12354 = -r12352;
        double r12355 = exp(r12354);
        double r12356 = r12353 + r12355;
        double r12357 = 2.0;
        double r12358 = 0.0;
        double r12359 = /* ERROR: no complex support in C */;
        double r12360 = r12356 / r12359;
        double r12361 = /* ERROR: no complex support in C */;
        return r12361;
}

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