Average Error: 0.1 → 0.1
Time: 2.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 r159781 = x;
        double r159782 = y;
        double r159783 = r159782 - r159781;
        double r159784 = fabs(r159783);
        double r159785 = 2.0;
        double r159786 = r159784 / r159785;
        double r159787 = r159781 + r159786;
        return r159787;
}

double f(double x, double y) {
        double r159788 = x;
        double r159789 = y;
        double r159790 = r159789 - r159788;
        double r159791 = fabs(r159790);
        double r159792 = 2.0;
        double r159793 = r159791 / r159792;
        double r159794 = r159788 + r159793;
        return r159794;
}

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