Average Error: 0.1 → 0.1
Time: 8.8s
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 r151807 = x;
        double r151808 = y;
        double r151809 = r151808 - r151807;
        double r151810 = fabs(r151809);
        double r151811 = 2.0;
        double r151812 = r151810 / r151811;
        double r151813 = r151807 + r151812;
        return r151813;
}

double f(double x, double y) {
        double r151814 = x;
        double r151815 = y;
        double r151816 = r151815 - r151814;
        double r151817 = fabs(r151816);
        double r151818 = 2.0;
        double r151819 = r151817 / r151818;
        double r151820 = r151814 + r151819;
        return r151820;
}

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. Simplified0.1

    \[\leadsto \color{blue}{\frac{\left|y - x\right|}{2} + x}\]
  3. Final simplification0.1

    \[\leadsto x + \frac{\left|y - x\right|}{2}\]

Reproduce

herbie shell --seed 2019179 
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
  (+ x (/ (fabs (- y x)) 2.0)))