Average Error: 5.7 → 0.1
Time: 10.4s
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 r42303845 = x;
        double r42303846 = y;
        double r42303847 = r42303846 * r42303846;
        double r42303848 = z;
        double r42303849 = r42303847 / r42303848;
        double r42303850 = r42303845 + r42303849;
        return r42303850;
}

double f(double x, double y, double z) {
        double r42303851 = x;
        double r42303852 = y;
        double r42303853 = z;
        double r42303854 = r42303852 / r42303853;
        double r42303855 = 1.0;
        double r42303856 = r42303855 / r42303852;
        double r42303857 = r42303854 / r42303856;
        double r42303858 = r42303851 + r42303857;
        return r42303858;
}

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)))