Average Error: 0.0 → 0
Time: 2.3s
Precision: 64
\[x + \frac{y - x}{2}\]
\[\frac{1}{2} \cdot \left(x + y\right)\]
x + \frac{y - x}{2}
\frac{1}{2} \cdot \left(x + y\right)
double f(double x, double y) {
        double r378042 = x;
        double r378043 = y;
        double r378044 = r378043 - r378042;
        double r378045 = 2.0;
        double r378046 = r378044 / r378045;
        double r378047 = r378042 + r378046;
        return r378047;
}

double f(double x, double y) {
        double r378048 = 1.0;
        double r378049 = 2.0;
        double r378050 = r378048 / r378049;
        double r378051 = x;
        double r378052 = y;
        double r378053 = r378051 + r378052;
        double r378054 = r378050 * r378053;
        return r378054;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.0
Target0
Herbie0
\[0.5 \cdot \left(x + y\right)\]

Derivation

  1. Initial program 0.0

    \[x + \frac{y - x}{2}\]
  2. Taylor expanded around 0 0

    \[\leadsto \color{blue}{0.5 \cdot x + 0.5 \cdot y}\]
  3. Simplified0

    \[\leadsto \color{blue}{\frac{1}{2} \cdot \left(x + y\right)}\]
  4. Final simplification0

    \[\leadsto \frac{1}{2} \cdot \left(x + y\right)\]

Reproduce

herbie shell --seed 2019303 
(FPCore (x y)
  :name "Numeric.Interval.Internal:bisect from intervals-0.7.1, A"
  :precision binary64

  :herbie-target
  (* 0.5 (+ x y))

  (+ x (/ (- y x) 2)))