Average Error: 15.1 → 0.0
Time: 587.0ms
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 r587861 = x;
        double r587862 = y;
        double r587863 = r587861 - r587862;
        double r587864 = 2.0;
        double r587865 = r587861 * r587864;
        double r587866 = r587865 * r587862;
        double r587867 = r587863 / r587866;
        return r587867;
}

double f(double x, double y) {
        double r587868 = 1.0;
        double r587869 = 2.0;
        double r587870 = y;
        double r587871 = r587869 * r587870;
        double r587872 = r587868 / r587871;
        double r587873 = x;
        double r587874 = r587873 * r587869;
        double r587875 = r587868 / r587874;
        double r587876 = r587872 - r587875;
        return r587876;
}

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 2020027 
(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)))