Average Error: 0.1 → 0.1
Time: 13.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 r6985802 = x;
        double r6985803 = y;
        double r6985804 = r6985803 - r6985802;
        double r6985805 = fabs(r6985804);
        double r6985806 = 2.0;
        double r6985807 = r6985805 / r6985806;
        double r6985808 = r6985802 + r6985807;
        return r6985808;
}

double f(double x, double y) {
        double r6985809 = y;
        double r6985810 = x;
        double r6985811 = r6985809 - r6985810;
        double r6985812 = fabs(r6985811);
        double r6985813 = 2.0;
        double r6985814 = r6985812 / r6985813;
        double r6985815 = r6985814 + r6985810;
        return r6985815;
}

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