Average Error: 0.0 → 0.0
Time: 12.3s
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 i\right)}\right))\]
\[\Re(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\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 i\right)}\right))
\Re(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))
double f(double xre, double xim) {
        double r12074 = xre;
        double r12075 = xim;
        double r12076 = /* ERROR: no complex support in C */;
        double r12077 = exp(r12076);
        double r12078 = -r12076;
        double r12079 = exp(r12078);
        double r12080 = r12077 + r12079;
        double r12081 = 2.0;
        double r12082 = 0.0;
        double r12083 = /* ERROR: no complex support in C */;
        double r12084 = r12080 / r12083;
        double r12085 = /* ERROR: no complex support in C */;
        return r12085;
}

double f(double xre, double xim) {
        double r12086 = xre;
        double r12087 = xim;
        double r12088 = /* ERROR: no complex support in C */;
        double r12089 = -r12088;
        double r12090 = exp(r12089);
        double r12091 = exp(r12088);
        double r12092 = r12090 + r12091;
        double r12093 = 2.0;
        double r12094 = 0.0;
        double r12095 = /* ERROR: no complex support in C */;
        double r12096 = r12092 / r12095;
        double r12097 = /* ERROR: no complex support in C */;
        return r12097;
}

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 i\right)}\right))\]
  2. Final simplification0.0

    \[\leadsto \Re(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))\]

Reproduce

herbie shell --seed 2019121 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power real part (p55)"
  (re (/.c (+.c (exp.c (complex xre xim)) (exp.c (neg.c (complex xre xim)))) (complex 2 0))))