Average Error: 43.7 → 43.7
Time: 11.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 r20068 = xre;
        double r20069 = xim;
        double r20070 = /* ERROR: no complex support in C */;
        double r20071 = exp(r20070);
        double r20072 = -r20070;
        double r20073 = exp(r20072);
        double r20074 = r20071 + r20073;
        double r20075 = 2.0;
        double r20076 = 0.0;
        double r20077 = /* ERROR: no complex support in C */;
        double r20078 = r20074 / r20077;
        double r20079 = /* ERROR: no complex support in C */;
        return r20079;
}

double f(double xre, double xim) {
        double r20080 = xre;
        double r20081 = xim;
        double r20082 = /* ERROR: no complex support in C */;
        double r20083 = exp(r20082);
        double r20084 = -r20082;
        double r20085 = exp(r20084);
        double r20086 = r20083 + r20085;
        double r20087 = 2.0;
        double r20088 = 0.0;
        double r20089 = /* ERROR: no complex support in C */;
        double r20090 = r20086 / r20089;
        double r20091 = /* ERROR: no complex support in C */;
        return r20091;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.7

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

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