Average Error: 15.5 → 0.0
Time: 1.1s
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 r497019 = x;
        double r497020 = y;
        double r497021 = r497019 - r497020;
        double r497022 = 2.0;
        double r497023 = r497019 * r497022;
        double r497024 = r497023 * r497020;
        double r497025 = r497021 / r497024;
        return r497025;
}

double f(double x, double y) {
        double r497026 = 1.0;
        double r497027 = 2.0;
        double r497028 = y;
        double r497029 = r497027 * r497028;
        double r497030 = r497026 / r497029;
        double r497031 = x;
        double r497032 = r497031 * r497027;
        double r497033 = r497026 / r497032;
        double r497034 = r497030 - r497033;
        return r497034;
}

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

Derivation

  1. Initial program 15.5

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

    \[\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{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 2020020 +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)))