Average Error: 0.1 → 0.1
Time: 15.3s
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 r8878112 = x;
        double r8878113 = y;
        double r8878114 = r8878113 - r8878112;
        double r8878115 = fabs(r8878114);
        double r8878116 = 2.0;
        double r8878117 = r8878115 / r8878116;
        double r8878118 = r8878112 + r8878117;
        return r8878118;
}

double f(double x, double y) {
        double r8878119 = y;
        double r8878120 = x;
        double r8878121 = r8878119 - r8878120;
        double r8878122 = fabs(r8878121);
        double r8878123 = 2.0;
        double r8878124 = r8878122 / r8878123;
        double r8878125 = r8878124 + r8878120;
        return r8878125;
}

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