Average Error: 0.1 → 0.1
Time: 12.0s
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 r6407272 = x;
        double r6407273 = y;
        double r6407274 = r6407273 - r6407272;
        double r6407275 = fabs(r6407274);
        double r6407276 = 2.0;
        double r6407277 = r6407275 / r6407276;
        double r6407278 = r6407272 + r6407277;
        return r6407278;
}

double f(double x, double y) {
        double r6407279 = y;
        double r6407280 = x;
        double r6407281 = r6407279 - r6407280;
        double r6407282 = fabs(r6407281);
        double r6407283 = 2.0;
        double r6407284 = r6407282 / r6407283;
        double r6407285 = r6407284 + r6407280;
        return r6407285;
}

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