Average Error: 43.7 → 43.7
Time: 26.5s
Precision: 64
\[\Im(\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))\]
\[\Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))\]
\Im(\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))
\Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))
double f(double xre, double xim) {
        double r12881 = xre;
        double r12882 = xim;
        double r12883 = /* ERROR: no complex support in C */;
        double r12884 = exp(r12883);
        double r12885 = -r12883;
        double r12886 = exp(r12885);
        double r12887 = r12884 + r12886;
        double r12888 = 2.0;
        double r12889 = 0.0;
        double r12890 = /* ERROR: no complex support in C */;
        double r12891 = r12887 / r12890;
        double r12892 = /* ERROR: no complex support in C */;
        return r12892;
}

double f(double xre, double xim) {
        double r12893 = xre;
        double r12894 = xim;
        double r12895 = /* ERROR: no complex support in C */;
        double r12896 = -r12895;
        double r12897 = exp(r12896);
        double r12898 = exp(r12895);
        double r12899 = r12897 + r12898;
        double r12900 = 2.0;
        double r12901 = 0.0;
        double r12902 = /* ERROR: no complex support in C */;
        double r12903 = r12899 / r12902;
        double r12904 = /* ERROR: no complex support in C */;
        return r12904;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.7

    \[\Im(\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 simplification43.7

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

Reproduce

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