Average Error: 43.4 → 43.4
Time: 11.0s
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 r16337 = xre;
        double r16338 = xim;
        double r16339 = /* ERROR: no complex support in C */;
        double r16340 = exp(r16339);
        double r16341 = -r16339;
        double r16342 = exp(r16341);
        double r16343 = r16340 + r16342;
        double r16344 = 2.0;
        double r16345 = 0.0;
        double r16346 = /* ERROR: no complex support in C */;
        double r16347 = r16343 / r16346;
        double r16348 = /* ERROR: no complex support in C */;
        return r16348;
}

double f(double xre, double xim) {
        double r16349 = xre;
        double r16350 = xim;
        double r16351 = /* ERROR: no complex support in C */;
        double r16352 = exp(r16351);
        double r16353 = -r16351;
        double r16354 = exp(r16353);
        double r16355 = r16352 + r16354;
        double r16356 = 2.0;
        double r16357 = 0.0;
        double r16358 = /* ERROR: no complex support in C */;
        double r16359 = r16355 / r16358;
        double r16360 = /* ERROR: no complex support in C */;
        return r16360;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.4

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

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