Average Error: 0.1 → 0.1
Time: 15.7s
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 r7233174 = x;
        double r7233175 = y;
        double r7233176 = r7233175 - r7233174;
        double r7233177 = fabs(r7233176);
        double r7233178 = 2.0;
        double r7233179 = r7233177 / r7233178;
        double r7233180 = r7233174 + r7233179;
        return r7233180;
}

double f(double x, double y) {
        double r7233181 = y;
        double r7233182 = x;
        double r7233183 = r7233181 - r7233182;
        double r7233184 = fabs(r7233183);
        double r7233185 = 2.0;
        double r7233186 = r7233184 / r7233185;
        double r7233187 = r7233186 + r7233182;
        return r7233187;
}

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