Average Error: 43.9 → 43.9
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 r13693 = xre;
        double r13694 = xim;
        double r13695 = /* ERROR: no complex support in C */;
        double r13696 = exp(r13695);
        double r13697 = -r13695;
        double r13698 = exp(r13697);
        double r13699 = r13696 + r13698;
        double r13700 = 2.0;
        double r13701 = 0.0;
        double r13702 = /* ERROR: no complex support in C */;
        double r13703 = r13699 / r13702;
        double r13704 = /* ERROR: no complex support in C */;
        return r13704;
}

double f(double xre, double xim) {
        double r13705 = xre;
        double r13706 = xim;
        double r13707 = /* ERROR: no complex support in C */;
        double r13708 = exp(r13707);
        double r13709 = -r13707;
        double r13710 = exp(r13709);
        double r13711 = r13708 + r13710;
        double r13712 = 2.0;
        double r13713 = 0.0;
        double r13714 = /* ERROR: no complex support in C */;
        double r13715 = r13711 / r13714;
        double r13716 = /* ERROR: no complex support in C */;
        return r13716;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.9

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

    \[\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 2020001 +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))))