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 r18185 = xre;
        double r18186 = xim;
        double r18187 = /* ERROR: no complex support in C */;
        double r18188 = exp(r18187);
        double r18189 = -r18187;
        double r18190 = exp(r18189);
        double r18191 = r18188 + r18190;
        double r18192 = 2.0;
        double r18193 = 0.0;
        double r18194 = /* ERROR: no complex support in C */;
        double r18195 = r18191 / r18194;
        double r18196 = /* ERROR: no complex support in C */;
        return r18196;
}

double f(double xre, double xim) {
        double r18197 = xre;
        double r18198 = xim;
        double r18199 = /* ERROR: no complex support in C */;
        double r18200 = exp(r18199);
        double r18201 = -r18199;
        double r18202 = exp(r18201);
        double r18203 = r18200 + r18202;
        double r18204 = 2.0;
        double r18205 = 0.0;
        double r18206 = /* ERROR: no complex support in C */;
        double r18207 = r18203 / r18206;
        double r18208 = /* ERROR: no complex support in C */;
        return r18208;
}

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