Average Error: 42.9 → 42.9
Time: 10.7s
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 r15532 = xre;
        double r15533 = xim;
        double r15534 = /* ERROR: no complex support in C */;
        double r15535 = exp(r15534);
        double r15536 = -r15534;
        double r15537 = exp(r15536);
        double r15538 = r15535 + r15537;
        double r15539 = 2.0;
        double r15540 = 0.0;
        double r15541 = /* ERROR: no complex support in C */;
        double r15542 = r15538 / r15541;
        double r15543 = /* ERROR: no complex support in C */;
        return r15543;
}

double f(double xre, double xim) {
        double r15544 = xre;
        double r15545 = xim;
        double r15546 = /* ERROR: no complex support in C */;
        double r15547 = exp(r15546);
        double r15548 = -r15546;
        double r15549 = exp(r15548);
        double r15550 = r15547 + r15549;
        double r15551 = 2.0;
        double r15552 = 0.0;
        double r15553 = /* ERROR: no complex support in C */;
        double r15554 = r15550 / r15553;
        double r15555 = /* ERROR: no complex support in C */;
        return r15555;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 42.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 simplification42.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 2020047 +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))))