Average Error: 43.6 → 43.6
Time: 10.6s
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 r3307 = xre;
        double r3308 = xim;
        double r3309 = /* ERROR: no complex support in C */;
        double r3310 = exp(r3309);
        double r3311 = -r3309;
        double r3312 = exp(r3311);
        double r3313 = r3310 + r3312;
        double r3314 = 2.0;
        double r3315 = 0.0;
        double r3316 = /* ERROR: no complex support in C */;
        double r3317 = r3313 / r3316;
        double r3318 = /* ERROR: no complex support in C */;
        return r3318;
}

double f(double xre, double xim) {
        double r3319 = xre;
        double r3320 = xim;
        double r3321 = /* ERROR: no complex support in C */;
        double r3322 = exp(r3321);
        double r3323 = -r3321;
        double r3324 = exp(r3323);
        double r3325 = r3322 + r3324;
        double r3326 = 2.0;
        double r3327 = 0.0;
        double r3328 = /* ERROR: no complex support in C */;
        double r3329 = r3325 / r3328;
        double r3330 = /* ERROR: no complex support in C */;
        return r3330;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.6

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

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