Average Error: 0.1 → 0.1
Time: 12.8s
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 r8483687 = x;
        double r8483688 = y;
        double r8483689 = r8483688 - r8483687;
        double r8483690 = fabs(r8483689);
        double r8483691 = 2.0;
        double r8483692 = r8483690 / r8483691;
        double r8483693 = r8483687 + r8483692;
        return r8483693;
}

double f(double x, double y) {
        double r8483694 = y;
        double r8483695 = x;
        double r8483696 = r8483694 - r8483695;
        double r8483697 = fabs(r8483696);
        double r8483698 = 2.0;
        double r8483699 = r8483697 / r8483698;
        double r8483700 = r8483699 + r8483695;
        return r8483700;
}

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 2019174 +o rules:numerics
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
  (+ x (/ (fabs (- y x)) 2.0)))