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 r6296966 = x;
        double r6296967 = y;
        double r6296968 = r6296967 - r6296966;
        double r6296969 = fabs(r6296968);
        double r6296970 = 2.0;
        double r6296971 = r6296969 / r6296970;
        double r6296972 = r6296966 + r6296971;
        return r6296972;
}

double f(double x, double y) {
        double r6296973 = y;
        double r6296974 = x;
        double r6296975 = r6296973 - r6296974;
        double r6296976 = fabs(r6296975);
        double r6296977 = 2.0;
        double r6296978 = r6296976 / r6296977;
        double r6296979 = r6296978 + r6296974;
        return r6296979;
}

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