Average Error: 14.9 → 0.4
Time: 5.9s
Precision: 64
\[\frac{x + y}{\left(x \cdot 2\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.475760874344247412285955891776113381999 \cdot 10^{-22} \lor \neg \left(y \le 8.032379764470728586268388231044118745118 \cdot 10^{-73}\right):\\ \;\;\;\;\frac{1}{x \cdot 2} \cdot \frac{x + y}{y}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x + y}{x \cdot 2}}{y}\\ \end{array}\]
\frac{x + y}{\left(x \cdot 2\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;y \le -1.475760874344247412285955891776113381999 \cdot 10^{-22} \lor \neg \left(y \le 8.032379764470728586268388231044118745118 \cdot 10^{-73}\right):\\
\;\;\;\;\frac{1}{x \cdot 2} \cdot \frac{x + y}{y}\\

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

\end{array}
double f(double x, double y) {
        double r387986 = x;
        double r387987 = y;
        double r387988 = r387986 + r387987;
        double r387989 = 2.0;
        double r387990 = r387986 * r387989;
        double r387991 = r387990 * r387987;
        double r387992 = r387988 / r387991;
        return r387992;
}

double f(double x, double y) {
        double r387993 = y;
        double r387994 = -1.4757608743442474e-22;
        bool r387995 = r387993 <= r387994;
        double r387996 = 8.032379764470729e-73;
        bool r387997 = r387993 <= r387996;
        double r387998 = !r387997;
        bool r387999 = r387995 || r387998;
        double r388000 = 1.0;
        double r388001 = x;
        double r388002 = 2.0;
        double r388003 = r388001 * r388002;
        double r388004 = r388000 / r388003;
        double r388005 = r388001 + r387993;
        double r388006 = r388005 / r387993;
        double r388007 = r388004 * r388006;
        double r388008 = r388005 / r388003;
        double r388009 = r388008 / r387993;
        double r388010 = r387999 ? r388007 : r388009;
        return r388010;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -1.4757608743442474e-22 or 8.032379764470729e-73 < y

    1. Initial program 13.5

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

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

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

    if -1.4757608743442474e-22 < y < 8.032379764470729e-73

    1. Initial program 17.0

      \[\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}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.4

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

Reproduce

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