Average Error: 13.1 → 2.9
Time: 9.2s
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 r509452 = x;
        double r509453 = y;
        double r509454 = z;
        double r509455 = r509453 + r509454;
        double r509456 = r509452 * r509455;
        double r509457 = r509456 / r509454;
        return r509457;
}

double f(double x, double y, double z) {
        double r509458 = x;
        double r509459 = z;
        double r509460 = y;
        double r509461 = r509460 + r509459;
        double r509462 = r509459 / r509461;
        double r509463 = r509458 / r509462;
        return r509463;
}

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

Original13.1
Target2.9
Herbie2.9
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Initial program 13.1

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

    \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
  4. Final simplification2.9

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

Reproduce

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