Average Error: 15.0 → 0.0
Time: 15.2s
Precision: 64
\[\frac{x - y}{\left(x \cdot 2\right) \cdot y}\]
\[\frac{0.5}{y} - \frac{0.5}{x}\]
\frac{x - y}{\left(x \cdot 2\right) \cdot y}
\frac{0.5}{y} - \frac{0.5}{x}
double f(double x, double y) {
        double r425023 = x;
        double r425024 = y;
        double r425025 = r425023 - r425024;
        double r425026 = 2.0;
        double r425027 = r425023 * r425026;
        double r425028 = r425027 * r425024;
        double r425029 = r425025 / r425028;
        return r425029;
}

double f(double x, double y) {
        double r425030 = 0.5;
        double r425031 = y;
        double r425032 = r425030 / r425031;
        double r425033 = x;
        double r425034 = r425030 / r425033;
        double r425035 = r425032 - r425034;
        return r425035;
}

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

Derivation

  1. Initial program 15.0

    \[\frac{x - y}{\left(x \cdot 2\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 2019208 +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)))