Average Error: 0.1 → 0.1
Time: 15.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 r159819 = x;
        double r159820 = y;
        double r159821 = r159820 - r159819;
        double r159822 = fabs(r159821);
        double r159823 = 2.0;
        double r159824 = r159822 / r159823;
        double r159825 = r159819 + r159824;
        return r159825;
}

double f(double x, double y) {
        double r159826 = x;
        double r159827 = y;
        double r159828 = r159827 - r159826;
        double r159829 = fabs(r159828);
        double r159830 = 2.0;
        double r159831 = r159829 / r159830;
        double r159832 = r159826 + r159831;
        return r159832;
}

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