Average Error: 5.9 → 0.1
Time: 8.0s
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 r994251 = x;
        double r994252 = y;
        double r994253 = r994252 * r994252;
        double r994254 = z;
        double r994255 = r994253 / r994254;
        double r994256 = r994251 + r994255;
        return r994256;
}

double f(double x, double y, double z) {
        double r994257 = x;
        double r994258 = y;
        double r994259 = z;
        double r994260 = r994259 / r994258;
        double r994261 = r994258 / r994260;
        double r994262 = r994257 + r994261;
        return r994262;
}

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