Average Error: 15.3 → 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 r26334778 = x;
        double r26334779 = y;
        double r26334780 = r26334778 + r26334779;
        double r26334781 = 2.0;
        double r26334782 = r26334778 * r26334781;
        double r26334783 = r26334782 * r26334779;
        double r26334784 = r26334780 / r26334783;
        return r26334784;
}

double f(double x, double y) {
        double r26334785 = 0.5;
        double r26334786 = y;
        double r26334787 = r26334785 / r26334786;
        double r26334788 = x;
        double r26334789 = r26334785 / r26334788;
        double r26334790 = r26334787 + r26334789;
        return r26334790;
}

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

Derivation

  1. Initial program 15.3

    \[\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}{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 2019170 
(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)))