Average Error: 0.0 → 0.0
Time: 15.7s
Precision: 64
\[\Re(\left(\frac{e^{xre + xim i} + e^{-\left(xre + xim i\right)}}{2 + 0 i}\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 r12867 = xre;
        double r12868 = xim;
        double r12869 = /* ERROR: no complex support in C */;
        double r12870 = exp(r12869);
        double r12871 = -r12869;
        double r12872 = exp(r12871);
        double r12873 = r12870 + r12872;
        double r12874 = 2.0;
        double r12875 = 0.0;
        double r12876 = /* ERROR: no complex support in C */;
        double r12877 = r12873 / r12876;
        double r12878 = /* ERROR: no complex support in C */;
        return r12878;
}

double f(double xre, double xim) {
        double r12879 = xre;
        double r12880 = xim;
        double r12881 = /* ERROR: no complex support in C */;
        double r12882 = -r12881;
        double r12883 = exp(r12882);
        double r12884 = exp(r12881);
        double r12885 = r12883 + r12884;
        double r12886 = 2.0;
        double r12887 = 0.0;
        double r12888 = /* ERROR: no complex support in C */;
        double r12889 = r12885 / r12888;
        double r12890 = /* ERROR: no complex support in C */;
        return r12890;
}

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

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