Average Error: 15.0 → 0.0
Time: 1.0s
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 r510317 = x;
        double r510318 = y;
        double r510319 = r510317 - r510318;
        double r510320 = 2.0;
        double r510321 = r510317 * r510320;
        double r510322 = r510321 * r510318;
        double r510323 = r510319 / r510322;
        return r510323;
}

double f(double x, double y) {
        double r510324 = 0.5;
        double r510325 = y;
        double r510326 = r510324 / r510325;
        double r510327 = x;
        double r510328 = r510324 / r510327;
        double r510329 = r510326 - r510328;
        return r510329;
}

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 2020045 +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)))