Average Error: 0.1 → 0.1
Time: 2.8s
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 r135112 = x;
        double r135113 = y;
        double r135114 = r135113 - r135112;
        double r135115 = fabs(r135114);
        double r135116 = 2.0;
        double r135117 = r135115 / r135116;
        double r135118 = r135112 + r135117;
        return r135118;
}

double f(double x, double y) {
        double r135119 = x;
        double r135120 = y;
        double r135121 = r135120 - r135119;
        double r135122 = fabs(r135121);
        double r135123 = 2.0;
        double r135124 = r135122 / r135123;
        double r135125 = r135119 + r135124;
        return r135125;
}

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