Average Error: 0.1 → 0.1
Time: 3.7s
Precision: 64
\[x + \frac{\left|y - x\right|}{2}\]
\[x + \frac{\left|y - x\right|}{2}\]
x + \frac{\left|y - x\right|}{2}
x + \frac{\left|y - x\right|}{2}
double f(double x, double y) {
        double r140683 = x;
        double r140684 = y;
        double r140685 = r140684 - r140683;
        double r140686 = fabs(r140685);
        double r140687 = 2.0;
        double r140688 = r140686 / r140687;
        double r140689 = r140683 + r140688;
        return r140689;
}

double f(double x, double y) {
        double r140690 = x;
        double r140691 = y;
        double r140692 = r140691 - r140690;
        double r140693 = fabs(r140692);
        double r140694 = 2.0;
        double r140695 = r140693 / r140694;
        double r140696 = r140690 + r140695;
        return r140696;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 0.1

    \[x + \frac{\left|y - x\right|}{2}\]
  2. Final simplification0.1

    \[\leadsto x + \frac{\left|y - x\right|}{2}\]

Reproduce

herbie shell --seed 2019352 +o rules:numerics
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
  :precision binary64
  (+ x (/ (fabs (- y x)) 2)))