Average Error: 43.8 → 43.8
Time: 11.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 r13161 = xre;
        double r13162 = xim;
        double r13163 = /* ERROR: no complex support in C */;
        double r13164 = exp(r13163);
        double r13165 = -r13163;
        double r13166 = exp(r13165);
        double r13167 = r13164 + r13166;
        double r13168 = 2.0;
        double r13169 = 0.0;
        double r13170 = /* ERROR: no complex support in C */;
        double r13171 = r13167 / r13170;
        double r13172 = /* ERROR: no complex support in C */;
        return r13172;
}

double f(double xre, double xim) {
        double r13173 = xre;
        double r13174 = xim;
        double r13175 = /* ERROR: no complex support in C */;
        double r13176 = exp(r13175);
        double r13177 = -r13175;
        double r13178 = exp(r13177);
        double r13179 = r13176 + r13178;
        double r13180 = 2.0;
        double r13181 = 0.0;
        double r13182 = /* ERROR: no complex support in C */;
        double r13183 = r13179 / r13182;
        double r13184 = /* ERROR: no complex support in C */;
        return r13184;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.8

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

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