Average Error: 0.1 → 0.1
Time: 12.0s
Precision: 64
\[x + \frac{x - y}{2}\]
\[\left(x + \frac{x}{2}\right) - \frac{y}{2}\]
x + \frac{x - y}{2}
\left(x + \frac{x}{2}\right) - \frac{y}{2}
double f(double x, double y) {
        double r699397 = x;
        double r699398 = y;
        double r699399 = r699397 - r699398;
        double r699400 = 2.0;
        double r699401 = r699399 / r699400;
        double r699402 = r699397 + r699401;
        return r699402;
}

double f(double x, double y) {
        double r699403 = x;
        double r699404 = 2.0;
        double r699405 = r699403 / r699404;
        double r699406 = r699403 + r699405;
        double r699407 = y;
        double r699408 = r699407 / r699404;
        double r699409 = r699406 - r699408;
        return r699409;
}

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.1
Target0.1
Herbie0.1
\[1.5 \cdot x - 0.5 \cdot y\]

Derivation

  1. Initial program 0.1

    \[x + \frac{x - y}{2}\]
  2. Using strategy rm
  3. Applied div-sub0.1

    \[\leadsto x + \color{blue}{\left(\frac{x}{2} - \frac{y}{2}\right)}\]
  4. Applied associate-+r-0.1

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

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

Reproduce

herbie shell --seed 2020043 +o rules:numerics
(FPCore (x y)
  :name "Graphics.Rendering.Chart.Axis.Types:hBufferRect from Chart-1.5.3"
  :precision binary64

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

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