Average Error: 43.2 → 43.2
Time: 26.1s
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 r9075 = xre;
        double r9076 = xim;
        double r9077 = /* ERROR: no complex support in C */;
        double r9078 = exp(r9077);
        double r9079 = -r9077;
        double r9080 = exp(r9079);
        double r9081 = r9078 + r9080;
        double r9082 = 2.0;
        double r9083 = 0.0;
        double r9084 = /* ERROR: no complex support in C */;
        double r9085 = r9081 / r9084;
        double r9086 = /* ERROR: no complex support in C */;
        return r9086;
}

double f(double xre, double xim) {
        double r9087 = xre;
        double r9088 = xim;
        double r9089 = /* ERROR: no complex support in C */;
        double r9090 = exp(r9089);
        double r9091 = -r9089;
        double r9092 = exp(r9091);
        double r9093 = r9090 + r9092;
        double r9094 = 2.0;
        double r9095 = 0.0;
        double r9096 = /* ERROR: no complex support in C */;
        double r9097 = r9093 / r9096;
        double r9098 = /* ERROR: no complex support in C */;
        return r9098;
}

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