Average Error: 5.9 → 0.1
Time: 11.3s
Precision: 64
\[x + \frac{y \cdot y}{z}\]
\[\frac{{y}^{\left(\frac{2}{2}\right)}}{\frac{z}{y}} + x\]
x + \frac{y \cdot y}{z}
\frac{{y}^{\left(\frac{2}{2}\right)}}{\frac{z}{y}} + x
double f(double x, double y, double z) {
        double r737666 = x;
        double r737667 = y;
        double r737668 = r737667 * r737667;
        double r737669 = z;
        double r737670 = r737668 / r737669;
        double r737671 = r737666 + r737670;
        return r737671;
}

double f(double x, double y, double z) {
        double r737672 = y;
        double r737673 = 2.0;
        double r737674 = r737673 / r737673;
        double r737675 = pow(r737672, r737674);
        double r737676 = z;
        double r737677 = r737676 / r737672;
        double r737678 = r737675 / r737677;
        double r737679 = x;
        double r737680 = r737678 + r737679;
        return r737680;
}

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. Simplified0.1

    \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{z}, y, x\right)}\]
  3. Using strategy rm
  4. Applied fma-udef0.1

    \[\leadsto \color{blue}{\frac{y}{z} \cdot y + x}\]
  5. Simplified5.9

    \[\leadsto \color{blue}{\frac{{y}^{2}}{z}} + x\]
  6. Using strategy rm
  7. Applied sqr-pow5.9

    \[\leadsto \frac{\color{blue}{{y}^{\left(\frac{2}{2}\right)} \cdot {y}^{\left(\frac{2}{2}\right)}}}{z} + x\]
  8. Applied associate-/l*0.1

    \[\leadsto \color{blue}{\frac{{y}^{\left(\frac{2}{2}\right)}}{\frac{z}{{y}^{\left(\frac{2}{2}\right)}}}} + x\]
  9. Simplified0.1

    \[\leadsto \frac{{y}^{\left(\frac{2}{2}\right)}}{\color{blue}{\frac{z}{y}}} + x\]
  10. Final simplification0.1

    \[\leadsto \frac{{y}^{\left(\frac{2}{2}\right)}}{\frac{z}{y}} + x\]

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