Average Error: 44.0 → 44.0
Time: 10.6s
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 r16524 = xre;
        double r16525 = xim;
        double r16526 = /* ERROR: no complex support in C */;
        double r16527 = exp(r16526);
        double r16528 = -r16526;
        double r16529 = exp(r16528);
        double r16530 = r16527 + r16529;
        double r16531 = 2.0;
        double r16532 = 0.0;
        double r16533 = /* ERROR: no complex support in C */;
        double r16534 = r16530 / r16533;
        double r16535 = /* ERROR: no complex support in C */;
        return r16535;
}

double f(double xre, double xim) {
        double r16536 = xre;
        double r16537 = xim;
        double r16538 = /* ERROR: no complex support in C */;
        double r16539 = exp(r16538);
        double r16540 = -r16538;
        double r16541 = exp(r16540);
        double r16542 = r16539 + r16541;
        double r16543 = 2.0;
        double r16544 = 0.0;
        double r16545 = /* ERROR: no complex support in C */;
        double r16546 = r16542 / r16545;
        double r16547 = /* ERROR: no complex support in C */;
        return r16547;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 44.0

    \[\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 simplification44.0

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