Average Error: 15.1 → 0.0
Time: 5.0s
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 r310194 = x;
        double r310195 = y;
        double r310196 = r310194 + r310195;
        double r310197 = 2.0;
        double r310198 = r310194 * r310197;
        double r310199 = r310198 * r310195;
        double r310200 = r310196 / r310199;
        return r310200;
}

double f(double x, double y) {
        double r310201 = 0.5;
        double r310202 = y;
        double r310203 = r310201 / r310202;
        double r310204 = x;
        double r310205 = r310201 / r310204;
        double r310206 = r310203 + r310205;
        return r310206;
}

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}{x} + \frac{0.5}{y}\]

Derivation

  1. Initial program 15.1

    \[\frac{x + y}{\left(x \cdot 2\right) \cdot y}\]
  2. Simplified15.1

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

    \[\leadsto \color{blue}{0.5 \cdot \frac{1}{x} + 0.5 \cdot \frac{1}{y}}\]
  4. Simplified0.0

    \[\leadsto \color{blue}{\frac{0.5}{y} + \frac{0.5}{x}}\]
  5. 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, C"

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

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