Average Error: 15.1 → 0.0
Time: 22.5s
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 r34190591 = x;
        double r34190592 = y;
        double r34190593 = r34190591 - r34190592;
        double r34190594 = 2.0;
        double r34190595 = r34190591 * r34190594;
        double r34190596 = r34190595 * r34190592;
        double r34190597 = r34190593 / r34190596;
        return r34190597;
}

double f(double x, double y) {
        double r34190598 = 0.5;
        double r34190599 = y;
        double r34190600 = r34190598 / r34190599;
        double r34190601 = x;
        double r34190602 = r34190598 / r34190601;
        double r34190603 = r34190600 - r34190602;
        return r34190603;
}

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}{\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 2019174 +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)))