Average Error: 43.8 → 43.8
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 r13340 = xre;
        double r13341 = xim;
        double r13342 = /* ERROR: no complex support in C */;
        double r13343 = exp(r13342);
        double r13344 = -r13342;
        double r13345 = exp(r13344);
        double r13346 = r13343 + r13345;
        double r13347 = 2.0;
        double r13348 = 0.0;
        double r13349 = /* ERROR: no complex support in C */;
        double r13350 = r13346 / r13349;
        double r13351 = /* ERROR: no complex support in C */;
        return r13351;
}

double f(double xre, double xim) {
        double r13352 = xre;
        double r13353 = xim;
        double r13354 = /* ERROR: no complex support in C */;
        double r13355 = exp(r13354);
        double r13356 = -r13354;
        double r13357 = exp(r13356);
        double r13358 = r13355 + r13357;
        double r13359 = 2.0;
        double r13360 = 0.0;
        double r13361 = /* ERROR: no complex support in C */;
        double r13362 = r13358 / r13361;
        double r13363 = /* ERROR: no complex support in C */;
        return r13363;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.8

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

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