Average Error: 5.9 → 0.1
Time: 10.2s
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 r978635 = x;
        double r978636 = y;
        double r978637 = r978636 * r978636;
        double r978638 = z;
        double r978639 = r978637 / r978638;
        double r978640 = r978635 + r978639;
        return r978640;
}

double f(double x, double y, double z) {
        double r978641 = x;
        double r978642 = y;
        double r978643 = z;
        double r978644 = r978643 / r978642;
        double r978645 = r978642 / r978644;
        double r978646 = r978641 + r978645;
        return r978646;
}

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

Derivation

  1. Initial program 5.9

    \[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 2020047 +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)))