Average Error: 0.1 → 0.1
Time: 18.4s
Precision: 64
\[x + \frac{\left|y - x\right|}{2}\]
\[\frac{\left|y - x\right|}{2} + x\]
x + \frac{\left|y - x\right|}{2}
\frac{\left|y - x\right|}{2} + x
double f(double x, double y) {
        double r7386872 = x;
        double r7386873 = y;
        double r7386874 = r7386873 - r7386872;
        double r7386875 = fabs(r7386874);
        double r7386876 = 2.0;
        double r7386877 = r7386875 / r7386876;
        double r7386878 = r7386872 + r7386877;
        return r7386878;
}

double f(double x, double y) {
        double r7386879 = y;
        double r7386880 = x;
        double r7386881 = r7386879 - r7386880;
        double r7386882 = fabs(r7386881);
        double r7386883 = 2.0;
        double r7386884 = r7386882 / r7386883;
        double r7386885 = r7386884 + r7386880;
        return r7386885;
}

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 \frac{\left|y - x\right|}{2} + x\]

Reproduce

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