Average Error: 0.1 → 0.1
Time: 20.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 r10067156 = x;
        double r10067157 = y;
        double r10067158 = r10067157 - r10067156;
        double r10067159 = fabs(r10067158);
        double r10067160 = 2.0;
        double r10067161 = r10067159 / r10067160;
        double r10067162 = r10067156 + r10067161;
        return r10067162;
}

double f(double x, double y) {
        double r10067163 = y;
        double r10067164 = x;
        double r10067165 = r10067163 - r10067164;
        double r10067166 = fabs(r10067165);
        double r10067167 = 2.0;
        double r10067168 = r10067166 / r10067167;
        double r10067169 = r10067168 + r10067164;
        return r10067169;
}

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