Average Error: 3.1 → 0.1
Time: 4.0s
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 r645816 = x;
        double r645817 = y;
        double r645818 = 1.1283791670955126;
        double r645819 = z;
        double r645820 = exp(r645819);
        double r645821 = r645818 * r645820;
        double r645822 = r645816 * r645817;
        double r645823 = r645821 - r645822;
        double r645824 = r645817 / r645823;
        double r645825 = r645816 + r645824;
        return r645825;
}

double f(double x, double y, double z) {
        double r645826 = x;
        double r645827 = 1.0;
        double r645828 = z;
        double r645829 = exp(r645828);
        double r645830 = y;
        double r645831 = r645829 / r645830;
        double r645832 = 1.1283791670955126;
        double r645833 = -r645826;
        double r645834 = fma(r645831, r645832, r645833);
        double r645835 = r645827 / r645834;
        double r645836 = r645826 + r645835;
        return r645836;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 3.1

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

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

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

Reproduce

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