Average Error: 0.0 → 0.0
Time: 4.6s
Precision: 64
\[\frac{x + y}{y + y}\]
\[\left(1 + \frac{x}{y}\right) \cdot \frac{1}{2}\]
\frac{x + y}{y + y}
\left(1 + \frac{x}{y}\right) \cdot \frac{1}{2}
double f(double x, double y) {
        double r498697 = x;
        double r498698 = y;
        double r498699 = r498697 + r498698;
        double r498700 = r498698 + r498698;
        double r498701 = r498699 / r498700;
        return r498701;
}

double f(double x, double y) {
        double r498702 = 1.0;
        double r498703 = x;
        double r498704 = y;
        double r498705 = r498703 / r498704;
        double r498706 = r498702 + r498705;
        double r498707 = 0.5;
        double r498708 = r498706 * r498707;
        return r498708;
}

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

Derivation

  1. Initial program 0.0

    \[\frac{x + y}{y + y}\]
  2. Simplified0.0

    \[\leadsto \color{blue}{\frac{y + x}{y + y}}\]
  3. Taylor expanded around 0 0.0

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

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(1 + \frac{x}{y}\right)}\]
  5. Final simplification0.0

    \[\leadsto \left(1 + \frac{x}{y}\right) \cdot \frac{1}{2}\]

Reproduce

herbie shell --seed 2019196 
(FPCore (x y)
  :name "Data.Random.Distribution.T:$ccdf from random-fu-0.2.6.2"

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

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