Average Error: 12.6 → 3.2
Time: 7.8s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\frac{x}{\frac{z}{y + z}}\]
\frac{x \cdot \left(y + z\right)}{z}
\frac{x}{\frac{z}{y + z}}
double f(double x, double y, double z) {
        double r288545 = x;
        double r288546 = y;
        double r288547 = z;
        double r288548 = r288546 + r288547;
        double r288549 = r288545 * r288548;
        double r288550 = r288549 / r288547;
        return r288550;
}

double f(double x, double y, double z) {
        double r288551 = x;
        double r288552 = z;
        double r288553 = y;
        double r288554 = r288553 + r288552;
        double r288555 = r288552 / r288554;
        double r288556 = r288551 / r288555;
        return r288556;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original12.6
Target3.2
Herbie3.2
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -1.072355443395786e-234 or 6.538483641819976e-134 < z

    1. Initial program 13.0

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied associate-/l*1.6

      \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]

    if -1.072355443395786e-234 < z < 6.538483641819976e-134

    1. Initial program 10.4

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Taylor expanded around 0 7.8

      \[\leadsto \color{blue}{\frac{x \cdot y}{z} + x}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.2

    \[\leadsto \frac{x}{\frac{z}{y + z}}\]

Reproduce

herbie shell --seed 2019303 
(FPCore (x y z)
  :name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
  :precision binary64

  :herbie-target
  (/ x (/ z (+ y z)))

  (/ (* x (+ y z)) z))