Average Error: 2.7 → 0.1
Time: 11.7s
Precision: 64
\[x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}\]
\[x + \frac{1}{\mathsf{fma}\left(\frac{1.128379167095512558560699289955664426088}{y}, e^{z}, -x\right)}\]
x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}
x + \frac{1}{\mathsf{fma}\left(\frac{1.128379167095512558560699289955664426088}{y}, e^{z}, -x\right)}
double f(double x, double y, double z) {
        double r255557 = x;
        double r255558 = y;
        double r255559 = 1.1283791670955126;
        double r255560 = z;
        double r255561 = exp(r255560);
        double r255562 = r255559 * r255561;
        double r255563 = r255557 * r255558;
        double r255564 = r255562 - r255563;
        double r255565 = r255558 / r255564;
        double r255566 = r255557 + r255565;
        return r255566;
}

double f(double x, double y, double z) {
        double r255567 = x;
        double r255568 = 1.0;
        double r255569 = 1.1283791670955126;
        double r255570 = y;
        double r255571 = r255569 / r255570;
        double r255572 = z;
        double r255573 = exp(r255572);
        double r255574 = -r255567;
        double r255575 = fma(r255571, r255573, r255574);
        double r255576 = r255568 / r255575;
        double r255577 = r255567 + r255576;
        return r255577;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original2.7
Target0.1
Herbie0.1
\[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.1

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

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

Reproduce

herbie shell --seed 2019303 +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.12837916709551256 y) (exp z)) x)))

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