Average Error: 0.1 → 0.0
Time: 723.0ms
Precision: 64
\[\frac{x + y}{y + y}\]
\[\frac{1}{2} \cdot \frac{x}{y} + \frac{1}{2}\]
\frac{x + y}{y + y}
\frac{1}{2} \cdot \frac{x}{y} + \frac{1}{2}
double f(double x, double y) {
        double r826727 = x;
        double r826728 = y;
        double r826729 = r826727 + r826728;
        double r826730 = r826728 + r826728;
        double r826731 = r826729 / r826730;
        return r826731;
}

double f(double x, double y) {
        double r826732 = 0.5;
        double r826733 = x;
        double r826734 = y;
        double r826735 = r826733 / r826734;
        double r826736 = r826732 * r826735;
        double r826737 = r826736 + r826732;
        return r826737;
}

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

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

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

Reproduce

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