Average Error: 15.0 → 0.5
Time: 6.1s
Precision: 64
\[\frac{x + y}{\left(x \cdot 2\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.221408588678627164348157744990647222139 \cdot 10^{-8} \lor \neg \left(x \le 6.512387421164835240080292418646396765453 \cdot 10^{90}\right):\\ \;\;\;\;\frac{\frac{x + y}{x \cdot 2}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot 2} \cdot \frac{x + y}{y}\\ \end{array}\]
\frac{x + y}{\left(x \cdot 2\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;x \le -2.221408588678627164348157744990647222139 \cdot 10^{-8} \lor \neg \left(x \le 6.512387421164835240080292418646396765453 \cdot 10^{90}\right):\\
\;\;\;\;\frac{\frac{x + y}{x \cdot 2}}{y}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{x \cdot 2} \cdot \frac{x + y}{y}\\

\end{array}
double f(double x, double y) {
        double r462682 = x;
        double r462683 = y;
        double r462684 = r462682 + r462683;
        double r462685 = 2.0;
        double r462686 = r462682 * r462685;
        double r462687 = r462686 * r462683;
        double r462688 = r462684 / r462687;
        return r462688;
}

double f(double x, double y) {
        double r462689 = x;
        double r462690 = -2.221408588678627e-08;
        bool r462691 = r462689 <= r462690;
        double r462692 = 6.512387421164835e+90;
        bool r462693 = r462689 <= r462692;
        double r462694 = !r462693;
        bool r462695 = r462691 || r462694;
        double r462696 = y;
        double r462697 = r462689 + r462696;
        double r462698 = 2.0;
        double r462699 = r462689 * r462698;
        double r462700 = r462697 / r462699;
        double r462701 = r462700 / r462696;
        double r462702 = 1.0;
        double r462703 = r462702 / r462699;
        double r462704 = r462697 / r462696;
        double r462705 = r462703 * r462704;
        double r462706 = r462695 ? r462701 : r462705;
        return r462706;
}

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

Derivation

  1. Split input into 2 regimes
  2. if x < -2.221408588678627e-08 or 6.512387421164835e+90 < x

    1. Initial program 17.2

      \[\frac{x + y}{\left(x \cdot 2\right) \cdot y}\]
    2. Using strategy rm
    3. Applied associate-/r*0.1

      \[\leadsto \color{blue}{\frac{\frac{x + y}{x \cdot 2}}{y}}\]

    if -2.221408588678627e-08 < x < 6.512387421164835e+90

    1. Initial program 13.3

      \[\frac{x + y}{\left(x \cdot 2\right) \cdot y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity13.3

      \[\leadsto \frac{\color{blue}{1 \cdot \left(x + y\right)}}{\left(x \cdot 2\right) \cdot y}\]
    4. Applied times-frac0.9

      \[\leadsto \color{blue}{\frac{1}{x \cdot 2} \cdot \frac{x + y}{y}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.221408588678627164348157744990647222139 \cdot 10^{-8} \lor \neg \left(x \le 6.512387421164835240080292418646396765453 \cdot 10^{90}\right):\\ \;\;\;\;\frac{\frac{x + y}{x \cdot 2}}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{x \cdot 2} \cdot \frac{x + y}{y}\\ \end{array}\]

Reproduce

herbie shell --seed 2019208 
(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)))