Average Error: 6.5 → 0.1
Time: 21.9s
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 r563895 = x;
        double r563896 = y;
        double r563897 = r563896 * r563896;
        double r563898 = z;
        double r563899 = r563897 / r563898;
        double r563900 = r563895 + r563899;
        return r563900;
}

double f(double x, double y, double z) {
        double r563901 = x;
        double r563902 = y;
        double r563903 = z;
        double r563904 = r563903 / r563902;
        double r563905 = r563902 / r563904;
        double r563906 = r563901 + r563905;
        return r563906;
}

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 2019199 +o rules:numerics
(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)))