Average Error: 15.7 → 0.0
Time: 1.7s
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 r447184 = x;
        double r447185 = y;
        double r447186 = r447184 - r447185;
        double r447187 = 2.0;
        double r447188 = r447184 * r447187;
        double r447189 = r447188 * r447185;
        double r447190 = r447186 / r447189;
        return r447190;
}

double f(double x, double y) {
        double r447191 = 1.0;
        double r447192 = 2.0;
        double r447193 = y;
        double r447194 = r447192 * r447193;
        double r447195 = r447191 / r447194;
        double r447196 = x;
        double r447197 = r447196 * r447192;
        double r447198 = r447191 / r447197;
        double r447199 = r447195 - r447198;
        return r447199;
}

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

Derivation

  1. Initial program 15.7

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

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

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