Average Error: 5.7 → 0.1
Time: 10.1s
Precision: 64
\[x + \frac{y \cdot y}{z}\]
\[x + \frac{\frac{y}{z}}{\frac{1}{y}}\]
x + \frac{y \cdot y}{z}
x + \frac{\frac{y}{z}}{\frac{1}{y}}
double f(double x, double y, double z) {
        double r42411497 = x;
        double r42411498 = y;
        double r42411499 = r42411498 * r42411498;
        double r42411500 = z;
        double r42411501 = r42411499 / r42411500;
        double r42411502 = r42411497 + r42411501;
        return r42411502;
}

double f(double x, double y, double z) {
        double r42411503 = x;
        double r42411504 = y;
        double r42411505 = z;
        double r42411506 = r42411504 / r42411505;
        double r42411507 = 1.0;
        double r42411508 = r42411507 / r42411504;
        double r42411509 = r42411506 / r42411508;
        double r42411510 = r42411503 + r42411509;
        return r42411510;
}

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

Original5.7
Target0.1
Herbie0.1
\[x + y \cdot \frac{y}{z}\]

Derivation

  1. Initial program 5.7

    \[x + \frac{y \cdot y}{z}\]
  2. Using strategy rm
  3. Applied associate-/l*0.1

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

    \[\leadsto x + \frac{y}{\color{blue}{z \cdot \frac{1}{y}}}\]
  6. Applied associate-/r*0.1

    \[\leadsto x + \color{blue}{\frac{\frac{y}{z}}{\frac{1}{y}}}\]
  7. Final simplification0.1

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

Reproduce

herbie shell --seed 2019163 
(FPCore (x y z)
  :name "Crypto.Random.Test:calculate from crypto-random-0.0.9"

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

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