Average Error: 15.3 → 0.0
Time: 2.3s
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 r372740 = x;
        double r372741 = y;
        double r372742 = r372740 - r372741;
        double r372743 = 2.0;
        double r372744 = r372740 * r372743;
        double r372745 = r372744 * r372741;
        double r372746 = r372742 / r372745;
        return r372746;
}

double f(double x, double y) {
        double r372747 = 0.5;
        double r372748 = y;
        double r372749 = r372747 / r372748;
        double r372750 = x;
        double r372751 = r372747 / r372750;
        double r372752 = r372749 - r372751;
        return r372752;
}

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

Derivation

  1. Initial program 15.3

    \[\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}{0.5 \cdot \left(\frac{1}{y} - \frac{1}{x}\right)}\]
  4. Final simplification0.0

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

Reproduce

herbie shell --seed 2019308 
(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)))