Average Error: 6.4 → 0.1
Time: 8.7s
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 r541652 = x;
        double r541653 = y;
        double r541654 = r541653 * r541653;
        double r541655 = z;
        double r541656 = r541654 / r541655;
        double r541657 = r541652 + r541656;
        return r541657;
}

double f(double x, double y, double z) {
        double r541658 = x;
        double r541659 = y;
        double r541660 = z;
        double r541661 = r541660 / r541659;
        double r541662 = r541659 / r541661;
        double r541663 = r541658 + r541662;
        return r541663;
}

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

Derivation

  1. Initial program 6.4

    \[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 2019196 
(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)))