Average Error: 43.4 → 43.4
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 r12803 = xre;
        double r12804 = xim;
        double r12805 = /* ERROR: no complex support in C */;
        double r12806 = exp(r12805);
        double r12807 = -r12805;
        double r12808 = exp(r12807);
        double r12809 = r12806 + r12808;
        double r12810 = 2.0;
        double r12811 = 0.0;
        double r12812 = /* ERROR: no complex support in C */;
        double r12813 = r12809 / r12812;
        double r12814 = /* ERROR: no complex support in C */;
        return r12814;
}

double f(double xre, double xim) {
        double r12815 = xre;
        double r12816 = xim;
        double r12817 = /* ERROR: no complex support in C */;
        double r12818 = -r12817;
        double r12819 = exp(r12818);
        double r12820 = exp(r12817);
        double r12821 = r12819 + r12820;
        double r12822 = 2.0;
        double r12823 = 0.0;
        double r12824 = /* ERROR: no complex support in C */;
        double r12825 = r12821 / r12824;
        double r12826 = /* ERROR: no complex support in C */;
        return r12826;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.4

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

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

Reproduce

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