Average Error: 0.0 → 0.0
Time: 5.1s
Precision: 64
\[\Re(\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))\]
\[\Re(\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))\]
\Re(\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))
\Re(\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 r13845 = xre;
        double r13846 = xim;
        double r13847 = /* ERROR: no complex support in C */;
        double r13848 = exp(r13847);
        double r13849 = -r13847;
        double r13850 = exp(r13849);
        double r13851 = r13848 + r13850;
        double r13852 = 2.0;
        double r13853 = 0.0;
        double r13854 = /* ERROR: no complex support in C */;
        double r13855 = r13851 / r13854;
        double r13856 = /* ERROR: no complex support in C */;
        return r13856;
}

double f(double xre, double xim) {
        double r13857 = xre;
        double r13858 = xim;
        double r13859 = /* ERROR: no complex support in C */;
        double r13860 = exp(r13859);
        double r13861 = -r13859;
        double r13862 = exp(r13861);
        double r13863 = r13860 + r13862;
        double r13864 = 2.0;
        double r13865 = 0.0;
        double r13866 = /* ERROR: no complex support in C */;
        double r13867 = r13863 / r13866;
        double r13868 = /* ERROR: no complex support in C */;
        return r13868;
}

Error

Bits error versus xre

Bits error versus xim

Derivation

  1. Initial program 0.0

    \[\Re(\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 simplification0.0

    \[\leadsto \Re(\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 2019347 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power real part (p55)"
  :precision binary64
  (re (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2 0.0))))