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 r493339 = x;
        double r493340 = y;
        double r493341 = r493339 - r493340;
        double r493342 = 2.0;
        double r493343 = r493339 * r493342;
        double r493344 = r493343 * r493340;
        double r493345 = r493341 / r493344;
        return r493345;
}

double f(double x, double y) {
        double r493346 = 1.0;
        double r493347 = 2.0;
        double r493348 = y;
        double r493349 = r493347 * r493348;
        double r493350 = r493346 / r493349;
        double r493351 = x;
        double r493352 = r493351 * r493347;
        double r493353 = r493346 / r493352;
        double r493354 = r493350 - r493353;
        return r493354;
}

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.2

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