Average Error: 15.1 → 0.0
Time: 1.3s
Precision: 64
\[\frac{x - y}{\left(x \cdot 2\right) \cdot y}\]
\[\frac{1}{2 \cdot y} - \frac{1}{x \cdot 2}\]
\frac{x - y}{\left(x \cdot 2\right) \cdot y}
\frac{1}{2 \cdot y} - \frac{1}{x \cdot 2}
double f(double x, double y) {
        double r409392 = x;
        double r409393 = y;
        double r409394 = r409392 - r409393;
        double r409395 = 2.0;
        double r409396 = r409392 * r409395;
        double r409397 = r409396 * r409393;
        double r409398 = r409394 / r409397;
        return r409398;
}

double f(double x, double y) {
        double r409399 = 1.0;
        double r409400 = 2.0;
        double r409401 = y;
        double r409402 = r409400 * r409401;
        double r409403 = r409399 / r409402;
        double r409404 = x;
        double r409405 = r409404 * r409400;
        double r409406 = r409399 / r409405;
        double r409407 = r409403 - r409406;
        return r409407;
}

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

Derivation

  1. Initial program 15.1

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

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

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

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

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

Reproduce

herbie shell --seed 2020062 +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)))