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 r20741 = xre;
        double r20742 = xim;
        double r20743 = /* ERROR: no complex support in C */;
        double r20744 = exp(r20743);
        double r20745 = -r20743;
        double r20746 = exp(r20745);
        double r20747 = r20744 + r20746;
        double r20748 = 2.0;
        double r20749 = 0.0;
        double r20750 = /* ERROR: no complex support in C */;
        double r20751 = r20747 / r20750;
        double r20752 = /* ERROR: no complex support in C */;
        return r20752;
}

double f(double xre, double xim) {
        double r20753 = xre;
        double r20754 = xim;
        double r20755 = /* ERROR: no complex support in C */;
        double r20756 = exp(r20755);
        double r20757 = -r20755;
        double r20758 = exp(r20757);
        double r20759 = r20756 + r20758;
        double r20760 = 2.0;
        double r20761 = 0.0;
        double r20762 = /* ERROR: no complex support in C */;
        double r20763 = r20759 / r20762;
        double r20764 = /* ERROR: no complex support in C */;
        return r20764;
}

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