Average Error: 14.6 → 0.0
Time: 5.8s
Precision: 64
\[\frac{x + y}{\left(x \cdot 2.0\right) \cdot y}\]
\[\frac{0.5}{x} + \frac{0.5}{y}\]
\frac{x + y}{\left(x \cdot 2.0\right) \cdot y}
\frac{0.5}{x} + \frac{0.5}{y}
double f(double x, double y) {
        double r20535973 = x;
        double r20535974 = y;
        double r20535975 = r20535973 + r20535974;
        double r20535976 = 2.0;
        double r20535977 = r20535973 * r20535976;
        double r20535978 = r20535977 * r20535974;
        double r20535979 = r20535975 / r20535978;
        return r20535979;
}

double f(double x, double y) {
        double r20535980 = 0.5;
        double r20535981 = x;
        double r20535982 = r20535980 / r20535981;
        double r20535983 = y;
        double r20535984 = r20535980 / r20535983;
        double r20535985 = r20535982 + r20535984;
        return r20535985;
}

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

Derivation

  1. Initial program 14.6

    \[\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}{x} + \frac{0.5}{y}}\]
  4. Final simplification0.0

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

Reproduce

herbie shell --seed 2019163 +o rules:numerics
(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)))