Average Error: 0.0 → 0.0
Time: 16.6s
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 r10759 = xre;
        double r10760 = xim;
        double r10761 = /* ERROR: no complex support in C */;
        double r10762 = exp(r10761);
        double r10763 = -r10761;
        double r10764 = exp(r10763);
        double r10765 = r10762 + r10764;
        double r10766 = 2.0;
        double r10767 = 0.0;
        double r10768 = /* ERROR: no complex support in C */;
        double r10769 = r10765 / r10768;
        double r10770 = /* ERROR: no complex support in C */;
        return r10770;
}

double f(double xre, double xim) {
        double r10771 = xre;
        double r10772 = xim;
        double r10773 = /* ERROR: no complex support in C */;
        double r10774 = -r10773;
        double r10775 = exp(r10774);
        double r10776 = exp(r10773);
        double r10777 = r10775 + r10776;
        double r10778 = 2.0;
        double r10779 = 0.0;
        double r10780 = /* ERROR: no complex support in C */;
        double r10781 = r10777 / r10780;
        double r10782 = /* ERROR: no complex support in C */;
        return r10782;
}

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