Average Error: 0.0 → 0.0
Time: 5.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.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 r28559 = xre;
        double r28560 = xim;
        double r28561 = /* ERROR: no complex support in C */;
        double r28562 = exp(r28561);
        double r28563 = -r28561;
        double r28564 = exp(r28563);
        double r28565 = r28562 + r28564;
        double r28566 = 2.0;
        double r28567 = 0.0;
        double r28568 = /* ERROR: no complex support in C */;
        double r28569 = r28565 / r28568;
        double r28570 = /* ERROR: no complex support in C */;
        return r28570;
}

double f(double xre, double xim) {
        double r28571 = xre;
        double r28572 = xim;
        double r28573 = /* ERROR: no complex support in C */;
        double r28574 = exp(r28573);
        double r28575 = -r28573;
        double r28576 = exp(r28575);
        double r28577 = r28574 + r28576;
        double r28578 = 2.0;
        double r28579 = 0.0;
        double r28580 = /* ERROR: no complex support in C */;
        double r28581 = r28577 / r28580;
        double r28582 = /* ERROR: no complex support in C */;
        return r28582;
}

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