Average Error: 13.1 → 2.9
Time: 12.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 r512818 = x;
        double r512819 = y;
        double r512820 = z;
        double r512821 = r512819 + r512820;
        double r512822 = r512818 * r512821;
        double r512823 = r512822 / r512820;
        return r512823;
}

double f(double x, double y, double z) {
        double r512824 = x;
        double r512825 = z;
        double r512826 = y;
        double r512827 = r512826 + r512825;
        double r512828 = r512825 / r512827;
        double r512829 = r512824 / r512828;
        return r512829;
}

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