Average Error: 43.2 → 43.2
Time: 27.1s
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 r12834 = xre;
        double r12835 = xim;
        double r12836 = /* ERROR: no complex support in C */;
        double r12837 = exp(r12836);
        double r12838 = -r12836;
        double r12839 = exp(r12838);
        double r12840 = r12837 + r12839;
        double r12841 = 2.0;
        double r12842 = 0.0;
        double r12843 = /* ERROR: no complex support in C */;
        double r12844 = r12840 / r12843;
        double r12845 = /* ERROR: no complex support in C */;
        return r12845;
}

double f(double xre, double xim) {
        double r12846 = xre;
        double r12847 = xim;
        double r12848 = /* ERROR: no complex support in C */;
        double r12849 = -r12848;
        double r12850 = exp(r12849);
        double r12851 = exp(r12848);
        double r12852 = r12850 + r12851;
        double r12853 = 2.0;
        double r12854 = 0.0;
        double r12855 = /* ERROR: no complex support in C */;
        double r12856 = r12852 / r12855;
        double r12857 = /* ERROR: no complex support in C */;
        return r12857;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.2

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

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

Reproduce

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