Average Error: 0.1 → 0.1
Time: 8.3s
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 r142031 = x;
        double r142032 = y;
        double r142033 = r142032 - r142031;
        double r142034 = fabs(r142033);
        double r142035 = 2.0;
        double r142036 = r142034 / r142035;
        double r142037 = r142031 + r142036;
        return r142037;
}

double f(double x, double y) {
        double r142038 = x;
        double r142039 = y;
        double r142040 = r142039 - r142038;
        double r142041 = fabs(r142040);
        double r142042 = 2.0;
        double r142043 = r142041 / r142042;
        double r142044 = r142038 + r142043;
        return r142044;
}

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