Average Error: 43.6 → 43.6
Time: 11.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 r13351 = xre;
        double r13352 = xim;
        double r13353 = /* ERROR: no complex support in C */;
        double r13354 = exp(r13353);
        double r13355 = -r13353;
        double r13356 = exp(r13355);
        double r13357 = r13354 + r13356;
        double r13358 = 2.0;
        double r13359 = 0.0;
        double r13360 = /* ERROR: no complex support in C */;
        double r13361 = r13357 / r13360;
        double r13362 = /* ERROR: no complex support in C */;
        return r13362;
}

double f(double xre, double xim) {
        double r13363 = xre;
        double r13364 = xim;
        double r13365 = /* ERROR: no complex support in C */;
        double r13366 = exp(r13365);
        double r13367 = -r13365;
        double r13368 = exp(r13367);
        double r13369 = r13366 + r13368;
        double r13370 = 2.0;
        double r13371 = 0.0;
        double r13372 = /* ERROR: no complex support in C */;
        double r13373 = r13369 / r13372;
        double r13374 = /* ERROR: no complex support in C */;
        return r13374;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.6

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

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