Average Error: 43.4 → 43.4
Time: 27.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 i\right)}\right))\]
\[\Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\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 i\right)}\right))
\Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))
double f(double xre, double xim) {
        double r10967 = xre;
        double r10968 = xim;
        double r10969 = /* ERROR: no complex support in C */;
        double r10970 = exp(r10969);
        double r10971 = -r10969;
        double r10972 = exp(r10971);
        double r10973 = r10970 + r10972;
        double r10974 = 2.0;
        double r10975 = 0.0;
        double r10976 = /* ERROR: no complex support in C */;
        double r10977 = r10973 / r10976;
        double r10978 = /* ERROR: no complex support in C */;
        return r10978;
}

double f(double xre, double xim) {
        double r10979 = xre;
        double r10980 = xim;
        double r10981 = /* ERROR: no complex support in C */;
        double r10982 = -r10981;
        double r10983 = exp(r10982);
        double r10984 = exp(r10981);
        double r10985 = r10983 + r10984;
        double r10986 = 2.0;
        double r10987 = 0.0;
        double r10988 = /* ERROR: no complex support in C */;
        double r10989 = r10985 / r10988;
        double r10990 = /* ERROR: no complex support in C */;
        return r10990;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 43.4

    \[\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 i\right)}\right))\]
  2. Final simplification43.4

    \[\leadsto \Im(\left(\frac{e^{-\left(xre + xim i\right)} + e^{xre + xim i}}{2 + 0 i}\right))\]

Reproduce

herbie shell --seed 2019128 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power imaginary part (p55)"
  (im (/.c (+.c (exp.c (complex xre xim)) (exp.c (neg.c (complex xre xim)))) (complex 2 0))))