Average Error: 0.0 → 0.0
Time: 16.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 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 r10984 = xre;
        double r10985 = xim;
        double r10986 = /* ERROR: no complex support in C */;
        double r10987 = exp(r10986);
        double r10988 = -r10986;
        double r10989 = exp(r10988);
        double r10990 = r10987 + r10989;
        double r10991 = 2.0;
        double r10992 = 0.0;
        double r10993 = /* ERROR: no complex support in C */;
        double r10994 = r10990 / r10993;
        double r10995 = /* ERROR: no complex support in C */;
        return r10995;
}

double f(double xre, double xim) {
        double r10996 = xre;
        double r10997 = xim;
        double r10998 = /* ERROR: no complex support in C */;
        double r10999 = -r10998;
        double r11000 = exp(r10999);
        double r11001 = exp(r10998);
        double r11002 = r11000 + r11001;
        double r11003 = 2.0;
        double r11004 = 0.0;
        double r11005 = /* ERROR: no complex support in C */;
        double r11006 = r11002 / r11005;
        double r11007 = /* ERROR: no complex support in C */;
        return r11007;
}

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