Average Error: 43.4 → 43.4
Time: 11.8s
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 r27765 = xre;
        double r27766 = xim;
        double r27767 = /* ERROR: no complex support in C */;
        double r27768 = exp(r27767);
        double r27769 = -r27767;
        double r27770 = exp(r27769);
        double r27771 = r27768 + r27770;
        double r27772 = 2.0;
        double r27773 = 0.0;
        double r27774 = /* ERROR: no complex support in C */;
        double r27775 = r27771 / r27774;
        double r27776 = /* ERROR: no complex support in C */;
        return r27776;
}

double f(double xre, double xim) {
        double r27777 = xre;
        double r27778 = xim;
        double r27779 = /* ERROR: no complex support in C */;
        double r27780 = exp(r27779);
        double r27781 = -r27779;
        double r27782 = exp(r27781);
        double r27783 = r27780 + r27782;
        double r27784 = 2.0;
        double r27785 = 0.0;
        double r27786 = /* ERROR: no complex support in C */;
        double r27787 = r27783 / r27786;
        double r27788 = /* ERROR: no complex support in C */;
        return r27788;
}

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