Average Error: 43.6 → 43.6
Time: 28.4s
Precision: 64
\[\Im(\left(\frac{e^{xre + xim i} + e^{-\left(xre + xim i\right)}}{2 + 0 i}\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 r12828 = xre;
        double r12829 = xim;
        double r12830 = /* ERROR: no complex support in C */;
        double r12831 = exp(r12830);
        double r12832 = -r12830;
        double r12833 = exp(r12832);
        double r12834 = r12831 + 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;
}

double f(double xre, double xim) {
        double r12840 = xre;
        double r12841 = xim;
        double r12842 = /* ERROR: no complex support in C */;
        double r12843 = -r12842;
        double r12844 = exp(r12843);
        double r12845 = exp(r12842);
        double r12846 = r12844 + r12845;
        double r12847 = 2.0;
        double r12848 = 0.0;
        double r12849 = /* ERROR: no complex support in C */;
        double r12850 = r12846 / r12849;
        double r12851 = /* ERROR: no complex support in C */;
        return r12851;
}

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

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