Average Error: 2.7 → 0.0
Time: 2.8s
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 r334395 = x;
        double r334396 = y;
        double r334397 = 1.1283791670955126;
        double r334398 = z;
        double r334399 = exp(r334398);
        double r334400 = r334397 * r334399;
        double r334401 = r334395 * r334396;
        double r334402 = r334400 - r334401;
        double r334403 = r334396 / r334402;
        double r334404 = r334395 + r334403;
        return r334404;
}

double f(double x, double y, double z) {
        double r334405 = x;
        double r334406 = 1.0;
        double r334407 = z;
        double r334408 = exp(r334407);
        double r334409 = y;
        double r334410 = r334408 / r334409;
        double r334411 = 1.1283791670955126;
        double r334412 = -r334405;
        double r334413 = fma(r334410, r334411, r334412);
        double r334414 = r334406 / r334413;
        double r334415 = r334405 + r334414;
        return r334415;
}

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)))))