Average Error: 43.6 → 43.6
Time: 26.3s
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 r12868 = xre;
        double r12869 = xim;
        double r12870 = /* ERROR: no complex support in C */;
        double r12871 = exp(r12870);
        double r12872 = -r12870;
        double r12873 = exp(r12872);
        double r12874 = r12871 + r12873;
        double r12875 = 2.0;
        double r12876 = 0.0;
        double r12877 = /* ERROR: no complex support in C */;
        double r12878 = r12874 / r12877;
        double r12879 = /* ERROR: no complex support in C */;
        return r12879;
}

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

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.6

    \[\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.6

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

Reproduce

herbie shell --seed 2019124 +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))))