Average Error: 0.1 → 0.1
Time: 2.2s
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 r156214 = x;
        double r156215 = y;
        double r156216 = r156215 - r156214;
        double r156217 = fabs(r156216);
        double r156218 = 2.0;
        double r156219 = r156217 / r156218;
        double r156220 = r156214 + r156219;
        return r156220;
}

double f(double x, double y) {
        double r156221 = x;
        double r156222 = y;
        double r156223 = r156222 - r156221;
        double r156224 = fabs(r156223);
        double r156225 = 2.0;
        double r156226 = r156224 / r156225;
        double r156227 = r156221 + r156226;
        return r156227;
}

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