Average Error: 5.7 → 0.1
Time: 2.8s
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 r845407 = x;
        double r845408 = y;
        double r845409 = r845408 * r845408;
        double r845410 = z;
        double r845411 = r845409 / r845410;
        double r845412 = r845407 + r845411;
        return r845412;
}

double f(double x, double y, double z) {
        double r845413 = x;
        double r845414 = y;
        double r845415 = z;
        double r845416 = r845415 / r845414;
        double r845417 = r845414 / r845416;
        double r845418 = r845413 + r845417;
        return r845418;
}

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

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

Reproduce

herbie shell --seed 2020100 +o rules:numerics
(FPCore (x y z)
  :name "Crypto.Random.Test:calculate from crypto-random-0.0.9"
  :precision binary64

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

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