Average Error: 2.7 → 0.1
Time: 3.2s
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 r330473 = x;
        double r330474 = y;
        double r330475 = 1.1283791670955126;
        double r330476 = z;
        double r330477 = exp(r330476);
        double r330478 = r330475 * r330477;
        double r330479 = r330473 * r330474;
        double r330480 = r330478 - r330479;
        double r330481 = r330474 / r330480;
        double r330482 = r330473 + r330481;
        return r330482;
}

double f(double x, double y, double z) {
        double r330483 = x;
        double r330484 = 1.0;
        double r330485 = 1.1283791670955126;
        double r330486 = z;
        double r330487 = exp(r330486);
        double r330488 = y;
        double r330489 = r330487 / r330488;
        double r330490 = -r330483;
        double r330491 = fma(r330485, r330489, r330490);
        double r330492 = r330484 / r330491;
        double r330493 = r330483 + r330492;
        return r330493;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Target

Original2.7
Target0.0
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. Taylor expanded around inf 0.1

    \[\leadsto x + \frac{1}{\color{blue}{1.128379167095512558560699289955664426088 \cdot \frac{e^{z}}{y} - x}}\]
  5. Using strategy rm
  6. Applied fma-neg0.1

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

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

Reproduce

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