Average Error: 43.8 → 43.8
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 r15858 = xre;
        double r15859 = xim;
        double r15860 = /* ERROR: no complex support in C */;
        double r15861 = exp(r15860);
        double r15862 = -r15860;
        double r15863 = exp(r15862);
        double r15864 = r15861 + r15863;
        double r15865 = 2.0;
        double r15866 = 0.0;
        double r15867 = /* ERROR: no complex support in C */;
        double r15868 = r15864 / r15867;
        double r15869 = /* ERROR: no complex support in C */;
        return r15869;
}

double f(double xre, double xim) {
        double r15870 = xre;
        double r15871 = xim;
        double r15872 = /* ERROR: no complex support in C */;
        double r15873 = exp(r15872);
        double r15874 = -r15872;
        double r15875 = exp(r15874);
        double r15876 = r15873 + r15875;
        double r15877 = 2.0;
        double r15878 = 0.0;
        double r15879 = /* ERROR: no complex support in C */;
        double r15880 = r15876 / r15879;
        double r15881 = /* ERROR: no complex support in C */;
        return r15881;
}

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