Average Error: 43.9 → 43.9
Time: 11.3s
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 r21525 = xre;
        double r21526 = xim;
        double r21527 = /* ERROR: no complex support in C */;
        double r21528 = exp(r21527);
        double r21529 = -r21527;
        double r21530 = exp(r21529);
        double r21531 = r21528 + r21530;
        double r21532 = 2.0;
        double r21533 = 0.0;
        double r21534 = /* ERROR: no complex support in C */;
        double r21535 = r21531 / r21534;
        double r21536 = /* ERROR: no complex support in C */;
        return r21536;
}

double f(double xre, double xim) {
        double r21537 = xre;
        double r21538 = xim;
        double r21539 = /* ERROR: no complex support in C */;
        double r21540 = exp(r21539);
        double r21541 = -r21539;
        double r21542 = exp(r21541);
        double r21543 = r21540 + r21542;
        double r21544 = 2.0;
        double r21545 = 0.0;
        double r21546 = /* ERROR: no complex support in C */;
        double r21547 = r21543 / r21546;
        double r21548 = /* ERROR: no complex support in C */;
        return r21548;
}

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