Average Error: 43.6 → 43.6
Time: 10.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 r17084 = xre;
        double r17085 = xim;
        double r17086 = /* ERROR: no complex support in C */;
        double r17087 = exp(r17086);
        double r17088 = -r17086;
        double r17089 = exp(r17088);
        double r17090 = r17087 + r17089;
        double r17091 = 2.0;
        double r17092 = 0.0;
        double r17093 = /* ERROR: no complex support in C */;
        double r17094 = r17090 / r17093;
        double r17095 = /* ERROR: no complex support in C */;
        return r17095;
}

double f(double xre, double xim) {
        double r17096 = xre;
        double r17097 = xim;
        double r17098 = /* ERROR: no complex support in C */;
        double r17099 = exp(r17098);
        double r17100 = -r17098;
        double r17101 = exp(r17100);
        double r17102 = r17099 + r17101;
        double r17103 = 2.0;
        double r17104 = 0.0;
        double r17105 = /* ERROR: no complex support in C */;
        double r17106 = r17102 / r17105;
        double r17107 = /* ERROR: no complex support in C */;
        return r17107;
}

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