Average Error: 12.4 → 2.9
Time: 9.0s
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 r404542 = x;
        double r404543 = y;
        double r404544 = z;
        double r404545 = r404543 + r404544;
        double r404546 = r404542 * r404545;
        double r404547 = r404546 / r404544;
        return r404547;
}

double f(double x, double y, double z) {
        double r404548 = x;
        double r404549 = z;
        double r404550 = y;
        double r404551 = r404550 + r404549;
        double r404552 = r404549 / r404551;
        double r404553 = r404548 / r404552;
        return r404553;
}

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.4
Target2.9
Herbie2.9
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -1.463437553141257e-248 or 3.3308078359433153e-122 < z

    1. Initial program 12.9

      \[\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.463437553141257e-248 < z < 3.3308078359433153e-122

    1. Initial program 9.5

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

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

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

Reproduce

herbie shell --seed 2019294 
(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))