Average Error: 43.4 → 43.4
Time: 10.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.0 i\right)}\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.0 i\right)}\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.0 i\right)}\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.0 i\right)}\right))
double f(double xre, double xim) {
        double r17681 = xre;
        double r17682 = xim;
        double r17683 = /* ERROR: no complex support in C */;
        double r17684 = exp(r17683);
        double r17685 = -r17683;
        double r17686 = exp(r17685);
        double r17687 = r17684 + r17686;
        double r17688 = 2.0;
        double r17689 = 0.0;
        double r17690 = /* ERROR: no complex support in C */;
        double r17691 = r17687 / r17690;
        double r17692 = /* ERROR: no complex support in C */;
        return r17692;
}

double f(double xre, double xim) {
        double r17693 = xre;
        double r17694 = xim;
        double r17695 = /* ERROR: no complex support in C */;
        double r17696 = exp(r17695);
        double r17697 = -r17695;
        double r17698 = exp(r17697);
        double r17699 = r17696 + r17698;
        double r17700 = 2.0;
        double r17701 = 0.0;
        double r17702 = /* ERROR: no complex support in C */;
        double r17703 = r17699 / r17702;
        double r17704 = /* ERROR: no complex support in C */;
        return r17704;
}

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.0 i\right)}\right))\]
  2. Final simplification43.4

    \[\leadsto \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.0 i\right)}\right))\]

Reproduce

herbie shell --seed 2020062 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power imaginary part (p55)"
  :precision binary64
  (im (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2 0.0))))