Average Error: 15.4 → 0.0
Time: 5.6s
Precision: 64
\[\frac{x - y}{\left(x \cdot 2\right) \cdot y}\]
\[\frac{\frac{1}{y}}{2} - \frac{1}{x \cdot 2}\]
\frac{x - y}{\left(x \cdot 2\right) \cdot y}
\frac{\frac{1}{y}}{2} - \frac{1}{x \cdot 2}
double f(double x, double y) {
        double r698678 = x;
        double r698679 = y;
        double r698680 = r698678 - r698679;
        double r698681 = 2.0;
        double r698682 = r698678 * r698681;
        double r698683 = r698682 * r698679;
        double r698684 = r698680 / r698683;
        return r698684;
}

double f(double x, double y) {
        double r698685 = 1.0;
        double r698686 = y;
        double r698687 = r698685 / r698686;
        double r698688 = 2.0;
        double r698689 = r698687 / r698688;
        double r698690 = x;
        double r698691 = r698690 * r698688;
        double r698692 = r698685 / r698691;
        double r698693 = r698689 - r698692;
        return r698693;
}

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}{y}}{2}} - \frac{y}{\left(x \cdot 2\right) \cdot y}\]
  5. Simplified0.0

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

    \[\leadsto \frac{\frac{1}{y}}{2} - \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)))