Average Error: 12.2 → 3.6
Time: 30.4s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[\frac{z + y}{z} \cdot x\]
\frac{x \cdot \left(y + z\right)}{z}
\frac{z + y}{z} \cdot x
double f(double x, double y, double z) {
        double r21833936 = x;
        double r21833937 = y;
        double r21833938 = z;
        double r21833939 = r21833937 + r21833938;
        double r21833940 = r21833936 * r21833939;
        double r21833941 = r21833940 / r21833938;
        return r21833941;
}

double f(double x, double y, double z) {
        double r21833942 = z;
        double r21833943 = y;
        double r21833944 = r21833942 + r21833943;
        double r21833945 = r21833944 / r21833942;
        double r21833946 = x;
        double r21833947 = r21833945 * r21833946;
        return r21833947;
}

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.2
Target3.3
Herbie3.6
\[\frac{x}{\frac{z}{y + z}}\]

Derivation

  1. Initial program 12.2

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

    \[\leadsto \color{blue}{\frac{x}{\frac{z}{y + z}}}\]
  4. Using strategy rm
  5. Applied div-inv3.6

    \[\leadsto \color{blue}{x \cdot \frac{1}{\frac{z}{y + z}}}\]
  6. Simplified3.6

    \[\leadsto x \cdot \color{blue}{\frac{z + y}{z}}\]
  7. Final simplification3.6

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

Reproduce

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

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

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