Average Error: 44.0 → 44.0
Time: 10.5s
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 r13861 = xre;
        double r13862 = xim;
        double r13863 = /* ERROR: no complex support in C */;
        double r13864 = exp(r13863);
        double r13865 = -r13863;
        double r13866 = exp(r13865);
        double r13867 = r13864 + r13866;
        double r13868 = 2.0;
        double r13869 = 0.0;
        double r13870 = /* ERROR: no complex support in C */;
        double r13871 = r13867 / r13870;
        double r13872 = /* ERROR: no complex support in C */;
        return r13872;
}

double f(double xre, double xim) {
        double r13873 = xre;
        double r13874 = xim;
        double r13875 = /* ERROR: no complex support in C */;
        double r13876 = exp(r13875);
        double r13877 = -r13875;
        double r13878 = exp(r13877);
        double r13879 = r13876 + r13878;
        double r13880 = 2.0;
        double r13881 = 0.0;
        double r13882 = /* ERROR: no complex support in C */;
        double r13883 = r13879 / r13882;
        double r13884 = /* ERROR: no complex support in C */;
        return r13884;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 44.0

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

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