Average Error: 12.2 → 3.3
Time: 3.8s
Precision: 64
\[\frac{x \cdot \left(y + z\right)}{z}\]
\[x \cdot \frac{y + z}{z}\]
\frac{x \cdot \left(y + z\right)}{z}
x \cdot \frac{y + z}{z}
double f(double x, double y, double z) {
        double r301449 = x;
        double r301450 = y;
        double r301451 = z;
        double r301452 = r301450 + r301451;
        double r301453 = r301449 * r301452;
        double r301454 = r301453 / r301451;
        return r301454;
}

double f(double x, double y, double z) {
        double r301455 = x;
        double r301456 = y;
        double r301457 = z;
        double r301458 = r301456 + r301457;
        double r301459 = r301458 / r301457;
        double r301460 = r301455 * r301459;
        return r301460;
}

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

Derivation

  1. Split input into 2 regimes
  2. if (/ (* x (+ y z)) z) < -inf.0 or -1.4971885255371005e+50 < (/ (* x (+ y z)) z) < 7.627030322092993e+43 or 3.194437381202253e+276 < (/ (* x (+ y z)) z)

    1. Initial program 18.2

      \[\frac{x \cdot \left(y + z\right)}{z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity18.2

      \[\leadsto \frac{x \cdot \left(y + z\right)}{\color{blue}{1 \cdot z}}\]
    4. Applied times-frac0.5

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

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

    if -inf.0 < (/ (* x (+ y z)) z) < -1.4971885255371005e+50 or 7.627030322092993e+43 < (/ (* x (+ y z)) z) < 3.194437381202253e+276

    1. Initial program 0.2

      \[\frac{x \cdot \left(y + z\right)}{z}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification3.3

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

Reproduce

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