Average Error: 0.0 → 0.0
Time: 15.7s
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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))
double f(double xre, double xim) {
        double r10086 = xre;
        double r10087 = xim;
        double r10088 = /* ERROR: no complex support in C */;
        double r10089 = exp(r10088);
        double r10090 = -r10088;
        double r10091 = exp(r10090);
        double r10092 = r10089 + r10091;
        double r10093 = 2.0;
        double r10094 = 0.0;
        double r10095 = /* ERROR: no complex support in C */;
        double r10096 = r10092 / r10095;
        double r10097 = /* ERROR: no complex support in C */;
        return r10097;
}

double f(double xre, double xim) {
        double r10098 = xre;
        double r10099 = xim;
        double r10100 = /* ERROR: no complex support in C */;
        double r10101 = -r10100;
        double r10102 = exp(r10101);
        double r10103 = exp(r10100);
        double r10104 = r10102 + r10103;
        double r10105 = 2.0;
        double r10106 = 0.0;
        double r10107 = /* ERROR: no complex support in C */;
        double r10108 = r10104 / r10107;
        double r10109 = /* ERROR: no complex support in C */;
        return r10109;
}

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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))\]

Reproduce

herbie shell --seed 2019170 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power real part (p55)"
  (re (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2.0 0.0))))