Average Error: 43.2 → 43.2
Time: 10.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 r14369 = xre;
        double r14370 = xim;
        double r14371 = /* ERROR: no complex support in C */;
        double r14372 = exp(r14371);
        double r14373 = -r14371;
        double r14374 = exp(r14373);
        double r14375 = r14372 + r14374;
        double r14376 = 2.0;
        double r14377 = 0.0;
        double r14378 = /* ERROR: no complex support in C */;
        double r14379 = r14375 / r14378;
        double r14380 = /* ERROR: no complex support in C */;
        return r14380;
}

double f(double xre, double xim) {
        double r14381 = xre;
        double r14382 = xim;
        double r14383 = /* ERROR: no complex support in C */;
        double r14384 = exp(r14383);
        double r14385 = -r14383;
        double r14386 = exp(r14385);
        double r14387 = r14384 + r14386;
        double r14388 = 2.0;
        double r14389 = 0.0;
        double r14390 = /* ERROR: no complex support in C */;
        double r14391 = r14387 / r14390;
        double r14392 = /* ERROR: no complex support in C */;
        return r14392;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.2

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

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