Average Error: 14.9 → 0.0
Time: 4.8s
Precision: 64
\[\frac{x + y}{\left(x \cdot 2.0\right) \cdot y}\]
\[\frac{0.5}{y} + \frac{0.5}{x}\]
\frac{x + y}{\left(x \cdot 2.0\right) \cdot y}
\frac{0.5}{y} + \frac{0.5}{x}
double f(double x, double y) {
        double r12261449 = x;
        double r12261450 = y;
        double r12261451 = r12261449 + r12261450;
        double r12261452 = 2.0;
        double r12261453 = r12261449 * r12261452;
        double r12261454 = r12261453 * r12261450;
        double r12261455 = r12261451 / r12261454;
        return r12261455;
}

double f(double x, double y) {
        double r12261456 = 0.5;
        double r12261457 = y;
        double r12261458 = r12261456 / r12261457;
        double r12261459 = x;
        double r12261460 = r12261456 / r12261459;
        double r12261461 = r12261458 + r12261460;
        return r12261461;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original14.9
Target0.0
Herbie0.0
\[\frac{0.5}{x} + \frac{0.5}{y}\]

Derivation

  1. Initial program 14.9

    \[\frac{x + y}{\left(x \cdot 2.0\right) \cdot y}\]
  2. Taylor expanded around 0 0.0

    \[\leadsto \color{blue}{0.5 \cdot \frac{1}{x} + 0.5 \cdot \frac{1}{y}}\]
  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 2019156 
(FPCore (x y)
  :name "Linear.Projection:inversePerspective from linear-1.19.1.3, C"

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

  (/ (+ x y) (* (* x 2.0) y)))