Average Error: 3.0 → 0.1
Time: 3.2s
Precision: 64
\[x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}\]
\[x + \frac{1}{\mathsf{fma}\left(\frac{e^{z}}{y}, 1.12837916709551256, -x\right)}\]
x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}
x + \frac{1}{\mathsf{fma}\left(\frac{e^{z}}{y}, 1.12837916709551256, -x\right)}
double f(double x, double y, double z) {
        double r416080 = x;
        double r416081 = y;
        double r416082 = 1.1283791670955126;
        double r416083 = z;
        double r416084 = exp(r416083);
        double r416085 = r416082 * r416084;
        double r416086 = r416080 * r416081;
        double r416087 = r416085 - r416086;
        double r416088 = r416081 / r416087;
        double r416089 = r416080 + r416088;
        return r416089;
}

double f(double x, double y, double z) {
        double r416090 = x;
        double r416091 = 1.0;
        double r416092 = z;
        double r416093 = exp(r416092);
        double r416094 = y;
        double r416095 = r416093 / r416094;
        double r416096 = 1.1283791670955126;
        double r416097 = -r416090;
        double r416098 = fma(r416095, r416096, r416097);
        double r416099 = r416091 / r416098;
        double r416100 = r416090 + r416099;
        return r416100;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original3.0
Target0.0
Herbie0.1
\[x + \frac{1}{\frac{1.12837916709551256}{y} \cdot e^{z} - x}\]

Derivation

  1. Initial program 3.0

    \[x + \frac{y}{1.12837916709551256 \cdot e^{z} - x \cdot y}\]
  2. Using strategy rm
  3. Applied clear-num3.0

    \[\leadsto x + \color{blue}{\frac{1}{\frac{1.12837916709551256 \cdot e^{z} - x \cdot y}{y}}}\]
  4. Simplified0.1

    \[\leadsto x + \frac{1}{\color{blue}{\mathsf{fma}\left(\frac{e^{z}}{y}, 1.12837916709551256, -x\right)}}\]
  5. Final simplification0.1

    \[\leadsto x + \frac{1}{\mathsf{fma}\left(\frac{e^{z}}{y}, 1.12837916709551256, -x\right)}\]

Reproduce

herbie shell --seed 2020024 +o rules:numerics
(FPCore (x y z)
  :name "Numeric.SpecFunctions:invErfc from math-functions-0.1.5.2, A"
  :precision binary64

  :herbie-target
  (+ x (/ 1 (- (* (/ 1.1283791670955126 y) (exp z)) x)))

  (+ x (/ y (- (* 1.1283791670955126 (exp z)) (* x y)))))