Average Error: 6.5 → 0.1
Time: 29.4s
Precision: 64
\[x + \frac{y \cdot y}{z}\]
\[x + \frac{y}{\frac{z}{y}}\]
x + \frac{y \cdot y}{z}
x + \frac{y}{\frac{z}{y}}
double f(double x, double y, double z) {
        double r42296083 = x;
        double r42296084 = y;
        double r42296085 = r42296084 * r42296084;
        double r42296086 = z;
        double r42296087 = r42296085 / r42296086;
        double r42296088 = r42296083 + r42296087;
        return r42296088;
}

double f(double x, double y, double z) {
        double r42296089 = x;
        double r42296090 = y;
        double r42296091 = z;
        double r42296092 = r42296091 / r42296090;
        double r42296093 = r42296090 / r42296092;
        double r42296094 = r42296089 + r42296093;
        return r42296094;
}

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

Original6.5
Target0.1
Herbie0.1
\[x + y \cdot \frac{y}{z}\]

Derivation

  1. Initial program 6.5

    \[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. Final simplification0.1

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

Reproduce

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