Average Error: 0.1 → 0.1
Time: 6.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 r801 = x;
        double r802 = y;
        double r803 = r802 - r801;
        double r804 = fabs(r803);
        double r805 = 2.0;
        double r806 = r804 / r805;
        double r807 = r801 + r806;
        return r807;
}

double f(double x, double y) {
        double r808 = x;
        double r809 = y;
        double r810 = r809 - r808;
        double r811 = fabs(r810);
        double r812 = 2.0;
        double r813 = r811 / r812;
        double r814 = r808 + r813;
        return r814;
}

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 2020025 +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)))