Average Error: 15.5 → 0.0
Time: 9.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 r420395 = x;
        double r420396 = y;
        double r420397 = r420395 + r420396;
        double r420398 = 2.0;
        double r420399 = r420395 * r420398;
        double r420400 = r420399 * r420396;
        double r420401 = r420397 / r420400;
        return r420401;
}

double f(double x, double y) {
        double r420402 = 0.5;
        double r420403 = y;
        double r420404 = r420402 / r420403;
        double r420405 = x;
        double r420406 = r420402 / r420405;
        double r420407 = r420404 + r420406;
        return r420407;
}

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

Derivation

  1. Initial program 15.5

    \[\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 2019303 +o rules:numerics
(FPCore (x y)
  :name "Linear.Projection:inversePerspective from linear-1.19.1.3, C"
  :precision binary64

  :herbie-target
  (+ (/ 0.5 x) (/ 0.5 y))

  (/ (+ x y) (* (* x 2) y)))