Average Error: 15.1 → 0.0
Time: 20.4s
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 r405314 = x;
        double r405315 = y;
        double r405316 = r405314 - r405315;
        double r405317 = 2.0;
        double r405318 = r405314 * r405317;
        double r405319 = r405318 * r405315;
        double r405320 = r405316 / r405319;
        return r405320;
}

double f(double x, double y) {
        double r405321 = 0.5;
        double r405322 = y;
        double r405323 = r405321 / r405322;
        double r405324 = x;
        double r405325 = r405321 / r405324;
        double r405326 = r405323 - r405325;
        return r405326;
}

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. Simplified7.9

    \[\leadsto \color{blue}{\frac{\frac{x - y}{x}}{2 \cdot y}}\]
  3. Taylor expanded around 0 0.0

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

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

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

Reproduce

herbie shell --seed 2019179 +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)))