Average Error: 14.6 → 0.0
Time: 12.1s
Precision: 64
\[\frac{x - y}{\left(x \cdot 2.0\right) \cdot y}\]
\[\frac{0.5}{y} - \frac{0.5}{x}\]
\frac{x - y}{\left(x \cdot 2.0\right) \cdot y}
\frac{0.5}{y} - \frac{0.5}{x}
double f(double x, double y) {
        double r19912904 = x;
        double r19912905 = y;
        double r19912906 = r19912904 - r19912905;
        double r19912907 = 2.0;
        double r19912908 = r19912904 * r19912907;
        double r19912909 = r19912908 * r19912905;
        double r19912910 = r19912906 / r19912909;
        return r19912910;
}

double f(double x, double y) {
        double r19912911 = 0.5;
        double r19912912 = y;
        double r19912913 = r19912911 / r19912912;
        double r19912914 = x;
        double r19912915 = r19912911 / r19912914;
        double r19912916 = r19912913 - r19912915;
        return r19912916;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.6
Target0.0
Herbie0.0
\[\frac{0.5}{y} - \frac{0.5}{x}\]

Derivation

  1. Initial program 14.6

    \[\frac{x - y}{\left(x \cdot 2.0\right) \cdot y}\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{0.5 \cdot \frac{1}{y} - 0.5 \cdot \frac{1}{x}}\]
  3. Simplified0.0

    \[\leadsto \color{blue}{\frac{0.5}{y} - \frac{0.5}{x}}\]
  4. Final simplification0.0

    \[\leadsto \frac{0.5}{y} - \frac{0.5}{x}\]

Reproduce

herbie shell --seed 2019164 +o rules:numerics
(FPCore (x y)
  :name "Linear.Projection:inversePerspective from linear-1.19.1.3, B"

  :herbie-target
  (- (/ 0.5 y) (/ 0.5 x))

  (/ (- x y) (* (* x 2.0) y)))