Average Error: 15.2 → 0.0
Time: 2.8s
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 r577491 = x;
        double r577492 = y;
        double r577493 = r577491 + r577492;
        double r577494 = 2.0;
        double r577495 = r577491 * r577494;
        double r577496 = r577495 * r577492;
        double r577497 = r577493 / r577496;
        return r577497;
}

double f(double x, double y) {
        double r577498 = 0.5;
        double r577499 = 1.0;
        double r577500 = y;
        double r577501 = r577499 / r577500;
        double r577502 = x;
        double r577503 = r577499 / r577502;
        double r577504 = r577501 + r577503;
        double r577505 = r577498 * r577504;
        return r577505;
}

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

Derivation

  1. Initial program 15.2

    \[\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 2019362 
(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)))