Average Error: 0.0 → 0.0
Time: 4.5s
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 r554986 = x;
        double r554987 = y;
        double r554988 = r554986 + r554987;
        double r554989 = r554987 + r554987;
        double r554990 = r554988 / r554989;
        return r554990;
}

double f(double x, double y) {
        double r554991 = 1.0;
        double r554992 = x;
        double r554993 = y;
        double r554994 = r554992 / r554993;
        double r554995 = r554991 + r554994;
        double r554996 = 0.5;
        double r554997 = r554995 * r554996;
        return r554997;
}

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