Average Error: 0.1 → 0.1
Time: 10.6s
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 r105872 = x;
        double r105873 = y;
        double r105874 = r105873 - r105872;
        double r105875 = fabs(r105874);
        double r105876 = 2.0;
        double r105877 = r105875 / r105876;
        double r105878 = r105872 + r105877;
        return r105878;
}

double f(double x, double y) {
        double r105879 = x;
        double r105880 = y;
        double r105881 = r105880 - r105879;
        double r105882 = fabs(r105881);
        double r105883 = 2.0;
        double r105884 = r105882 / r105883;
        double r105885 = r105879 + r105884;
        return r105885;
}

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