Average Error: 43.2 → 43.2
Time: 10.8s
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 r15190 = xre;
        double r15191 = xim;
        double r15192 = /* ERROR: no complex support in C */;
        double r15193 = exp(r15192);
        double r15194 = -r15192;
        double r15195 = exp(r15194);
        double r15196 = r15193 + r15195;
        double r15197 = 2.0;
        double r15198 = 0.0;
        double r15199 = /* ERROR: no complex support in C */;
        double r15200 = r15196 / r15199;
        double r15201 = /* ERROR: no complex support in C */;
        return r15201;
}

double f(double xre, double xim) {
        double r15202 = xre;
        double r15203 = xim;
        double r15204 = /* ERROR: no complex support in C */;
        double r15205 = exp(r15204);
        double r15206 = -r15204;
        double r15207 = exp(r15206);
        double r15208 = r15205 + r15207;
        double r15209 = 2.0;
        double r15210 = 0.0;
        double r15211 = /* ERROR: no complex support in C */;
        double r15212 = r15208 / r15211;
        double r15213 = /* ERROR: no complex support in C */;
        return r15213;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.2

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

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