Average Error: 2.9 → 0.1
Time: 11.7s
Precision: 64
\[x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}\]
\[x + \frac{1}{\mathsf{fma}\left(1.128379167095512558560699289955664426088, \frac{e^{z}}{y}, -x\right)}\]
x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}
x + \frac{1}{\mathsf{fma}\left(1.128379167095512558560699289955664426088, \frac{e^{z}}{y}, -x\right)}
double f(double x, double y, double z) {
        double r332127 = x;
        double r332128 = y;
        double r332129 = 1.1283791670955126;
        double r332130 = z;
        double r332131 = exp(r332130);
        double r332132 = r332129 * r332131;
        double r332133 = r332127 * r332128;
        double r332134 = r332132 - r332133;
        double r332135 = r332128 / r332134;
        double r332136 = r332127 + r332135;
        return r332136;
}

double f(double x, double y, double z) {
        double r332137 = x;
        double r332138 = 1.0;
        double r332139 = 1.1283791670955126;
        double r332140 = z;
        double r332141 = exp(r332140);
        double r332142 = y;
        double r332143 = r332141 / r332142;
        double r332144 = -r332137;
        double r332145 = fma(r332139, r332143, r332144);
        double r332146 = r332138 / r332145;
        double r332147 = r332137 + r332146;
        return r332147;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

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

Derivation

  1. Initial program 2.9

    \[x + \frac{y}{1.128379167095512558560699289955664426088 \cdot e^{z} - x \cdot y}\]
  2. Simplified2.9

    \[\leadsto \color{blue}{x + \frac{y}{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y}}\]
  3. Using strategy rm
  4. Applied clear-num2.9

    \[\leadsto x + \color{blue}{\frac{1}{\frac{e^{z} \cdot 1.128379167095512558560699289955664426088 - x \cdot y}{y}}}\]
  5. Simplified2.9

    \[\leadsto x + \frac{1}{\color{blue}{\frac{\mathsf{fma}\left(1.128379167095512558560699289955664426088, e^{z}, -x \cdot y\right)}{y}}}\]
  6. Taylor expanded around inf 0.1

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

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

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

Reproduce

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

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

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