Average Error: 15.6 → 0.0
Time: 5.3s
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 r579489 = x;
        double r579490 = y;
        double r579491 = r579489 - r579490;
        double r579492 = 2.0;
        double r579493 = r579489 * r579492;
        double r579494 = r579493 * r579490;
        double r579495 = r579491 / r579494;
        return r579495;
}

double f(double x, double y) {
        double r579496 = 1.0;
        double r579497 = y;
        double r579498 = r579496 / r579497;
        double r579499 = 2.0;
        double r579500 = r579498 / r579499;
        double r579501 = x;
        double r579502 = r579501 * r579499;
        double r579503 = r579496 / r579502;
        double r579504 = r579500 - r579503;
        return r579504;
}

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.6
Target0.0
Herbie0.0
\[\frac{0.5}{y} - \frac{0.5}{x}\]

Derivation

  1. Initial program 15.6

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

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

    \[\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 2020047 +o rules:numerics
(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)))