Average Error: 2.8 → 0.0
Time: 16.1s
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 r298602 = x;
        double r298603 = y;
        double r298604 = 1.1283791670955126;
        double r298605 = z;
        double r298606 = exp(r298605);
        double r298607 = r298604 * r298606;
        double r298608 = r298602 * r298603;
        double r298609 = r298607 - r298608;
        double r298610 = r298603 / r298609;
        double r298611 = r298602 + r298610;
        return r298611;
}

double f(double x, double y, double z) {
        double r298612 = x;
        double r298613 = 1.0;
        double r298614 = 1.1283791670955126;
        double r298615 = y;
        double r298616 = r298614 / r298615;
        double r298617 = z;
        double r298618 = exp(r298617);
        double r298619 = -r298612;
        double r298620 = fma(r298616, r298618, r298619);
        double r298621 = r298613 / r298620;
        double r298622 = r298612 + r298621;
        return r298622;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 2.8

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

    \[\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{1.128379167095512558560699289955664426088}{y}, e^{z}, -x\right)}}\]
  5. Final simplification0.0

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

Reproduce

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