Average Error: 0.0 → 0.0
Time: 13.0s
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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))
double f(double xre, double xim) {
        double r8960 = xre;
        double r8961 = xim;
        double r8962 = /* ERROR: no complex support in C */;
        double r8963 = exp(r8962);
        double r8964 = -r8962;
        double r8965 = exp(r8964);
        double r8966 = r8963 + r8965;
        double r8967 = 2.0;
        double r8968 = 0.0;
        double r8969 = /* ERROR: no complex support in C */;
        double r8970 = r8966 / r8969;
        double r8971 = /* ERROR: no complex support in C */;
        return r8971;
}

double f(double xre, double xim) {
        double r8972 = xre;
        double r8973 = xim;
        double r8974 = /* ERROR: no complex support in C */;
        double r8975 = -r8974;
        double r8976 = exp(r8975);
        double r8977 = exp(r8974);
        double r8978 = r8976 + r8977;
        double r8979 = 2.0;
        double r8980 = 0.0;
        double r8981 = /* ERROR: no complex support in C */;
        double r8982 = r8978 / r8981;
        double r8983 = /* ERROR: no complex support in C */;
        return r8983;
}

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(-\left(xre + xim i\right)\right)}\right) + \left(e^{\left(xre + xim i\right)}\right)\right)}{\left(2 + 0.0 i\right)}\right))\]

Reproduce

herbie shell --seed 2019194 +o rules:numerics
(FPCore (xre xim)
  :name "exp with complex power real part (p55)"
  (re (/ (+ (exp (complex xre xim)) (exp (- (complex xre xim)))) (complex 2.0 0.0))))