Average Error: 43.4 → 43.4
Time: 13.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 r109 = xre;
        double r110 = xim;
        double r111 = /* ERROR: no complex support in C */;
        double r112 = exp(r111);
        double r113 = -r111;
        double r114 = exp(r113);
        double r115 = r112 + r114;
        double r116 = 2.0;
        double r117 = 0.0;
        double r118 = /* ERROR: no complex support in C */;
        double r119 = r115 / r118;
        double r120 = /* ERROR: no complex support in C */;
        return r120;
}

double f(double xre, double xim) {
        double r121 = xre;
        double r122 = xim;
        double r123 = /* ERROR: no complex support in C */;
        double r124 = exp(r123);
        double r125 = -r123;
        double r126 = exp(r125);
        double r127 = r124 + r126;
        double r128 = 2.0;
        double r129 = 0.0;
        double r130 = /* ERROR: no complex support in C */;
        double r131 = r127 / r130;
        double r132 = /* ERROR: no complex support in C */;
        return r132;
}

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 2020025 +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))))