Average Error: 2.7 → 0.0
Time: 2.9s
Precision: 64
\[x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}\]
\[x + \frac{1}{\mathsf{fma}\left(\frac{e^{z}}{y}, 1.128379167095512558560699289955664426088, -x\right)}\]
x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}
x + \frac{1}{\mathsf{fma}\left(\frac{e^{z}}{y}, 1.128379167095512558560699289955664426088, -x\right)}
double f(double x, double y, double z) {
        double r382422 = x;
        double r382423 = y;
        double r382424 = 1.1283791670955126;
        double r382425 = z;
        double r382426 = exp(r382425);
        double r382427 = r382424 * r382426;
        double r382428 = r382422 * r382423;
        double r382429 = r382427 - r382428;
        double r382430 = r382423 / r382429;
        double r382431 = r382422 + r382430;
        return r382431;
}

double f(double x, double y, double z) {
        double r382432 = x;
        double r382433 = 1.0;
        double r382434 = z;
        double r382435 = exp(r382434);
        double r382436 = y;
        double r382437 = r382435 / r382436;
        double r382438 = 1.1283791670955126;
        double r382439 = -r382432;
        double r382440 = fma(r382437, r382438, r382439);
        double r382441 = r382433 / r382440;
        double r382442 = r382432 + r382441;
        return r382442;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original2.7
Target0.0
Herbie0.0
\[x + \frac{1}{\frac{1.128379167095512558560699289955664426088}{y} \cdot e^{z} - x}\]

Derivation

  1. Initial program 2.7

    \[x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}\]
  2. Using strategy rm
  3. Applied clear-num2.7

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

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

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

Reproduce

herbie shell --seed 2019353 +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)))))