Average Error: 0.1 → 0.1
Time: 15.2s
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 r7909464 = x;
        double r7909465 = y;
        double r7909466 = r7909465 - r7909464;
        double r7909467 = fabs(r7909466);
        double r7909468 = 2.0;
        double r7909469 = r7909467 / r7909468;
        double r7909470 = r7909464 + r7909469;
        return r7909470;
}

double f(double x, double y) {
        double r7909471 = y;
        double r7909472 = x;
        double r7909473 = r7909471 - r7909472;
        double r7909474 = fabs(r7909473);
        double r7909475 = 2.0;
        double r7909476 = r7909474 / r7909475;
        double r7909477 = r7909476 + r7909472;
        return r7909477;
}

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