Average Error: 0.0 → 0.0
Time: 4.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 r19682 = xre;
        double r19683 = xim;
        double r19684 = /* ERROR: no complex support in C */;
        double r19685 = exp(r19684);
        double r19686 = -r19684;
        double r19687 = exp(r19686);
        double r19688 = r19685 + r19687;
        double r19689 = 2.0;
        double r19690 = 0.0;
        double r19691 = /* ERROR: no complex support in C */;
        double r19692 = r19688 / r19691;
        double r19693 = /* ERROR: no complex support in C */;
        return r19693;
}

double f(double xre, double xim) {
        double r19694 = xre;
        double r19695 = xim;
        double r19696 = /* ERROR: no complex support in C */;
        double r19697 = exp(r19696);
        double r19698 = -r19696;
        double r19699 = exp(r19698);
        double r19700 = r19697 + r19699;
        double r19701 = 2.0;
        double r19702 = 0.0;
        double r19703 = /* ERROR: no complex support in C */;
        double r19704 = r19700 / r19703;
        double r19705 = /* ERROR: no complex support in C */;
        return r19705;
}

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