Average Error: 0.0 → 0.0
Time: 5.2s
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 r32305 = xre;
        double r32306 = xim;
        double r32307 = /* ERROR: no complex support in C */;
        double r32308 = exp(r32307);
        double r32309 = -r32307;
        double r32310 = exp(r32309);
        double r32311 = r32308 + r32310;
        double r32312 = 2.0;
        double r32313 = 0.0;
        double r32314 = /* ERROR: no complex support in C */;
        double r32315 = r32311 / r32314;
        double r32316 = /* ERROR: no complex support in C */;
        return r32316;
}

double f(double xre, double xim) {
        double r32317 = xre;
        double r32318 = xim;
        double r32319 = /* ERROR: no complex support in C */;
        double r32320 = exp(r32319);
        double r32321 = -r32319;
        double r32322 = exp(r32321);
        double r32323 = r32320 + r32322;
        double r32324 = 2.0;
        double r32325 = 0.0;
        double r32326 = /* ERROR: no complex support in C */;
        double r32327 = r32323 / r32326;
        double r32328 = /* ERROR: no complex support in C */;
        return r32328;
}

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 2019347 
(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))))