Average Error: 15.2 → 0.0
Time: 1.5s
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 r538057 = x;
        double r538058 = y;
        double r538059 = r538057 + r538058;
        double r538060 = 2.0;
        double r538061 = r538057 * r538060;
        double r538062 = r538061 * r538058;
        double r538063 = r538059 / r538062;
        return r538063;
}

double f(double x, double y) {
        double r538064 = 0.5;
        double r538065 = 1.0;
        double r538066 = y;
        double r538067 = r538065 / r538066;
        double r538068 = x;
        double r538069 = r538065 / r538068;
        double r538070 = r538067 + r538069;
        double r538071 = r538064 * r538070;
        return r538071;
}

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 2020001 
(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)))