Average Error: 5.4 → 0.1
Time: 9.0s
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 r49281943 = x;
        double r49281944 = y;
        double r49281945 = r49281944 * r49281944;
        double r49281946 = z;
        double r49281947 = r49281945 / r49281946;
        double r49281948 = r49281943 + r49281947;
        return r49281948;
}

double f(double x, double y, double z) {
        double r49281949 = x;
        double r49281950 = y;
        double r49281951 = z;
        double r49281952 = r49281950 / r49281951;
        double r49281953 = 1.0;
        double r49281954 = r49281953 / r49281950;
        double r49281955 = r49281952 / r49281954;
        double r49281956 = r49281949 + r49281955;
        return r49281956;
}

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.4
Target0.1
Herbie0.1
\[x + y \cdot \frac{y}{z}\]

Derivation

  1. Initial program 5.4

    \[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 2019158 
(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)))