Average Error: 15.4 → 0.0
Time: 6.2s
Precision: 64
\[\frac{x - y}{\left(x \cdot 2\right) \cdot y}\]
\[\frac{\frac{1}{2}}{y} - \frac{1}{x \cdot 2}\]
\frac{x - y}{\left(x \cdot 2\right) \cdot y}
\frac{\frac{1}{2}}{y} - \frac{1}{x \cdot 2}
double f(double x, double y) {
        double r621428 = x;
        double r621429 = y;
        double r621430 = r621428 - r621429;
        double r621431 = 2.0;
        double r621432 = r621428 * r621431;
        double r621433 = r621432 * r621429;
        double r621434 = r621430 / r621433;
        return r621434;
}

double f(double x, double y) {
        double r621435 = 1.0;
        double r621436 = 2.0;
        double r621437 = r621435 / r621436;
        double r621438 = y;
        double r621439 = r621437 / r621438;
        double r621440 = x;
        double r621441 = r621440 * r621436;
        double r621442 = r621435 / r621441;
        double r621443 = r621439 - r621442;
        return r621443;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original15.4
Target0.0
Herbie0.0
\[\frac{0.5}{y} - \frac{0.5}{x}\]

Derivation

  1. Initial program 15.4

    \[\frac{x - y}{\left(x \cdot 2\right) \cdot y}\]
  2. Using strategy rm
  3. Applied div-sub15.4

    \[\leadsto \color{blue}{\frac{x}{\left(x \cdot 2\right) \cdot y} - \frac{y}{\left(x \cdot 2\right) \cdot y}}\]
  4. Simplified11.6

    \[\leadsto \color{blue}{\frac{\frac{1}{2}}{y}} - \frac{y}{\left(x \cdot 2\right) \cdot y}\]
  5. Simplified0.0

    \[\leadsto \frac{\frac{1}{2}}{y} - \color{blue}{\frac{1}{x \cdot 2}}\]
  6. Final simplification0.0

    \[\leadsto \frac{\frac{1}{2}}{y} - \frac{1}{x \cdot 2}\]

Reproduce

herbie shell --seed 2020046 
(FPCore (x y)
  :name "Linear.Projection:inversePerspective from linear-1.19.1.3, B"
  :precision binary64

  :herbie-target
  (- (/ 0.5 y) (/ 0.5 x))

  (/ (- x y) (* (* x 2) y)))