Average Error: 0.1 → 0.1
Time: 8.5s
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 r166388 = x;
        double r166389 = y;
        double r166390 = r166389 - r166388;
        double r166391 = fabs(r166390);
        double r166392 = 2.0;
        double r166393 = r166391 / r166392;
        double r166394 = r166388 + r166393;
        return r166394;
}

double f(double x, double y) {
        double r166395 = x;
        double r166396 = y;
        double r166397 = r166396 - r166395;
        double r166398 = fabs(r166397);
        double r166399 = 2.0;
        double r166400 = r166398 / r166399;
        double r166401 = r166395 + r166400;
        return r166401;
}

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