Average Error: 0.1 → 0.0
Time: 3.8s
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 r698668 = x;
        double r698669 = y;
        double r698670 = r698668 + r698669;
        double r698671 = r698669 + r698669;
        double r698672 = r698670 / r698671;
        return r698672;
}

double f(double x, double y) {
        double r698673 = 1.0;
        double r698674 = x;
        double r698675 = y;
        double r698676 = r698674 / r698675;
        double r698677 = r698673 + r698676;
        double r698678 = 0.5;
        double r698679 = r698677 * r698678;
        return r698679;
}

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

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