Average Error: 0.1 → 0.1
Time: 3.6s
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 r165965 = x;
        double r165966 = y;
        double r165967 = r165966 - r165965;
        double r165968 = fabs(r165967);
        double r165969 = 2.0;
        double r165970 = r165968 / r165969;
        double r165971 = r165965 + r165970;
        return r165971;
}

double f(double x, double y) {
        double r165972 = x;
        double r165973 = y;
        double r165974 = r165973 - r165972;
        double r165975 = fabs(r165974);
        double r165976 = 2.0;
        double r165977 = r165975 / r165976;
        double r165978 = r165972 + r165977;
        return r165978;
}

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 x + \frac{\left|y - x\right|}{2}\]

Reproduce

herbie shell --seed 2020056 +o rules:numerics
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
  :precision binary64
  (+ x (/ (fabs (- y x)) 2)))