Average Error: 0.0 → 0.0
Time: 4.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 r12189 = xre;
        double r12190 = xim;
        double r12191 = /* ERROR: no complex support in C */;
        double r12192 = exp(r12191);
        double r12193 = -r12191;
        double r12194 = exp(r12193);
        double r12195 = r12192 + r12194;
        double r12196 = 2.0;
        double r12197 = 0.0;
        double r12198 = /* ERROR: no complex support in C */;
        double r12199 = r12195 / r12198;
        double r12200 = /* ERROR: no complex support in C */;
        return r12200;
}

double f(double xre, double xim) {
        double r12201 = xre;
        double r12202 = xim;
        double r12203 = /* ERROR: no complex support in C */;
        double r12204 = exp(r12203);
        double r12205 = -r12203;
        double r12206 = exp(r12205);
        double r12207 = r12204 + r12206;
        double r12208 = 2.0;
        double r12209 = 0.0;
        double r12210 = /* ERROR: no complex support in C */;
        double r12211 = r12207 / r12210;
        double r12212 = /* ERROR: no complex support in C */;
        return r12212;
}

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