Average Error: 43.4 → 43.4
Time: 11.4s
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 r17707 = xre;
        double r17708 = xim;
        double r17709 = /* ERROR: no complex support in C */;
        double r17710 = exp(r17709);
        double r17711 = -r17709;
        double r17712 = exp(r17711);
        double r17713 = r17710 + r17712;
        double r17714 = 2.0;
        double r17715 = 0.0;
        double r17716 = /* ERROR: no complex support in C */;
        double r17717 = r17713 / r17716;
        double r17718 = /* ERROR: no complex support in C */;
        return r17718;
}

double f(double xre, double xim) {
        double r17719 = xre;
        double r17720 = xim;
        double r17721 = /* ERROR: no complex support in C */;
        double r17722 = exp(r17721);
        double r17723 = -r17721;
        double r17724 = exp(r17723);
        double r17725 = r17722 + r17724;
        double r17726 = 2.0;
        double r17727 = 0.0;
        double r17728 = /* ERROR: no complex support in C */;
        double r17729 = r17725 / r17728;
        double r17730 = /* ERROR: no complex support in C */;
        return r17730;
}

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