Average Error: 0.0 → 0.0
Time: 9.6s
Precision: 64
\[\frac{x + y}{y + y}\]
\[\frac{\frac{x}{y} + 1}{2}\]
\frac{x + y}{y + y}
\frac{\frac{x}{y} + 1}{2}
double f(double x, double y) {
        double r634581 = x;
        double r634582 = y;
        double r634583 = r634581 + r634582;
        double r634584 = r634582 + r634582;
        double r634585 = r634583 / r634584;
        return r634585;
}

double f(double x, double y) {
        double r634586 = x;
        double r634587 = y;
        double r634588 = r634586 / r634587;
        double r634589 = 1.0;
        double r634590 = r634588 + r634589;
        double r634591 = 2.0;
        double r634592 = r634590 / r634591;
        return r634592;
}

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. Taylor expanded around 0 0.0

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

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

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

Reproduce

herbie shell --seed 2019303 
(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)))