Average Error: 0.0 → 0.0
Time: 12.5s
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 r12816 = xre;
        double r12817 = xim;
        double r12818 = /* ERROR: no complex support in C */;
        double r12819 = exp(r12818);
        double r12820 = -r12818;
        double r12821 = exp(r12820);
        double r12822 = r12819 + r12821;
        double r12823 = 2.0;
        double r12824 = 0.0;
        double r12825 = /* ERROR: no complex support in C */;
        double r12826 = r12822 / r12825;
        double r12827 = /* ERROR: no complex support in C */;
        return r12827;
}

double f(double xre, double xim) {
        double r12828 = xre;
        double r12829 = xim;
        double r12830 = /* ERROR: no complex support in C */;
        double r12831 = -r12830;
        double r12832 = exp(r12831);
        double r12833 = exp(r12830);
        double r12834 = r12832 + r12833;
        double r12835 = 2.0;
        double r12836 = 0.0;
        double r12837 = /* ERROR: no complex support in C */;
        double r12838 = r12834 / r12837;
        double r12839 = /* ERROR: no complex support in C */;
        return r12839;
}

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