Average Error: 43.9 → 43.9
Time: 10.4s
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 r21277 = xre;
        double r21278 = xim;
        double r21279 = /* ERROR: no complex support in C */;
        double r21280 = exp(r21279);
        double r21281 = -r21279;
        double r21282 = exp(r21281);
        double r21283 = r21280 + r21282;
        double r21284 = 2.0;
        double r21285 = 0.0;
        double r21286 = /* ERROR: no complex support in C */;
        double r21287 = r21283 / r21286;
        double r21288 = /* ERROR: no complex support in C */;
        return r21288;
}

double f(double xre, double xim) {
        double r21289 = xre;
        double r21290 = xim;
        double r21291 = /* ERROR: no complex support in C */;
        double r21292 = exp(r21291);
        double r21293 = -r21291;
        double r21294 = exp(r21293);
        double r21295 = r21292 + r21294;
        double r21296 = 2.0;
        double r21297 = 0.0;
        double r21298 = /* ERROR: no complex support in C */;
        double r21299 = r21295 / r21298;
        double r21300 = /* ERROR: no complex support in C */;
        return r21300;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.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 simplification43.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 2020033 +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))))