Average Error: 15.0 → 0.5
Time: 6.8s
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 r279746 = x;
        double r279747 = y;
        double r279748 = r279746 + r279747;
        double r279749 = 2.0;
        double r279750 = r279746 * r279749;
        double r279751 = r279750 * r279747;
        double r279752 = r279748 / r279751;
        return r279752;
}

double f(double x, double y) {
        double r279753 = x;
        double r279754 = -2.221408588678627e-08;
        bool r279755 = r279753 <= r279754;
        double r279756 = 6.512387421164835e+90;
        bool r279757 = r279753 <= r279756;
        double r279758 = !r279757;
        bool r279759 = r279755 || r279758;
        double r279760 = y;
        double r279761 = r279753 + r279760;
        double r279762 = 2.0;
        double r279763 = r279753 * r279762;
        double r279764 = r279761 / r279763;
        double r279765 = r279764 / r279760;
        double r279766 = 1.0;
        double r279767 = r279766 / r279763;
        double r279768 = r279761 / r279760;
        double r279769 = r279767 * r279768;
        double r279770 = r279759 ? r279765 : r279769;
        return r279770;
}

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 +o rules:numerics
(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)))