Average Error: 15.1 → 0.0
Time: 1.3s
Precision: 64
\[\frac{x - y}{\left(x \cdot 2\right) \cdot y}\]
\[0.5 \cdot \left(\frac{1}{y} - \frac{1}{x}\right)\]
\frac{x - y}{\left(x \cdot 2\right) \cdot y}
0.5 \cdot \left(\frac{1}{y} - \frac{1}{x}\right)
double f(double x, double y) {
        double r610963 = x;
        double r610964 = y;
        double r610965 = r610963 - r610964;
        double r610966 = 2.0;
        double r610967 = r610963 * r610966;
        double r610968 = r610967 * r610964;
        double r610969 = r610965 / r610968;
        return r610969;
}

double f(double x, double y) {
        double r610970 = 0.5;
        double r610971 = 1.0;
        double r610972 = y;
        double r610973 = r610971 / r610972;
        double r610974 = x;
        double r610975 = r610971 / r610974;
        double r610976 = r610973 - r610975;
        double r610977 = r610970 * r610976;
        return r610977;
}

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

Reproduce

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