Average Error: 0.1 → 0.0
Time: 10.0s
Precision: 64
\[\frac{x + y}{y + y}\]
\[\frac{\frac{x + y}{2}}{y}\]
\frac{x + y}{y + y}
\frac{\frac{x + y}{2}}{y}
double f(double x, double y) {
        double r479047 = x;
        double r479048 = y;
        double r479049 = r479047 + r479048;
        double r479050 = r479048 + r479048;
        double r479051 = r479049 / r479050;
        return r479051;
}

double f(double x, double y) {
        double r479052 = x;
        double r479053 = y;
        double r479054 = r479052 + r479053;
        double r479055 = 2.0;
        double r479056 = r479054 / r479055;
        double r479057 = r479056 / r479053;
        return r479057;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.1
Target0.0
Herbie0.0
\[0.5 \cdot \frac{x}{y} + 0.5\]

Derivation

  1. Initial program 0.1

    \[\frac{x + y}{y + y}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity0.1

    \[\leadsto \frac{x + y}{\color{blue}{1 \cdot y} + y}\]
  4. Applied distribute-lft1-in0.1

    \[\leadsto \frac{x + y}{\color{blue}{\left(1 + 1\right) \cdot y}}\]
  5. Applied associate-/r*0.0

    \[\leadsto \color{blue}{\frac{\frac{x + y}{1 + 1}}{y}}\]
  6. Simplified0.0

    \[\leadsto \frac{\color{blue}{\frac{x + y}{2}}}{y}\]
  7. Final simplification0.0

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

Reproduce

herbie shell --seed 2019322 +o rules:numerics
(FPCore (x y)
  :name "Data.Random.Distribution.T:$ccdf from random-fu-0.2.6.2"
  :precision binary64

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

  (/ (+ x y) (+ y y)))