Average Error: 15.2 → 0.4
Time: 13.8s
Precision: 64
\[\frac{x + y}{\left(x \cdot 2\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;y \le -1.392096079342848193007314734731115011171 \cdot 10^{-86} \lor \neg \left(y \le 5.173054498508759236112133194996942845024 \cdot 10^{-30}\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.392096079342848193007314734731115011171 \cdot 10^{-86} \lor \neg \left(y \le 5.173054498508759236112133194996942845024 \cdot 10^{-30}\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 r355200 = x;
        double r355201 = y;
        double r355202 = r355200 + r355201;
        double r355203 = 2.0;
        double r355204 = r355200 * r355203;
        double r355205 = r355204 * r355201;
        double r355206 = r355202 / r355205;
        return r355206;
}

double f(double x, double y) {
        double r355207 = y;
        double r355208 = -1.3920960793428482e-86;
        bool r355209 = r355207 <= r355208;
        double r355210 = 5.173054498508759e-30;
        bool r355211 = r355207 <= r355210;
        double r355212 = !r355211;
        bool r355213 = r355209 || r355212;
        double r355214 = 1.0;
        double r355215 = x;
        double r355216 = 2.0;
        double r355217 = r355215 * r355216;
        double r355218 = r355214 / r355217;
        double r355219 = r355215 + r355207;
        double r355220 = r355219 / r355207;
        double r355221 = r355218 * r355220;
        double r355222 = r355219 / r355217;
        double r355223 = r355222 / r355207;
        double r355224 = r355213 ? r355221 : r355223;
        return r355224;
}

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

Derivation

  1. Split input into 2 regimes
  2. if y < -1.3920960793428482e-86 or 5.173054498508759e-30 < 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.3920960793428482e-86 < y < 5.173054498508759e-30

    1. Initial program 17.8

      \[\frac{x + y}{\left(x \cdot 2\right) \cdot y}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt18.5

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}{x \cdot 2} \cdot \frac{\sqrt[3]{x + y}}{y}}\]
    5. Using strategy rm
    6. Applied pow17.6

      \[\leadsto \frac{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}{x \cdot 2} \cdot \color{blue}{{\left(\frac{\sqrt[3]{x + y}}{y}\right)}^{1}}\]
    7. Applied pow17.6

      \[\leadsto \color{blue}{{\left(\frac{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}{x \cdot 2}\right)}^{1}} \cdot {\left(\frac{\sqrt[3]{x + y}}{y}\right)}^{1}\]
    8. Applied pow-prod-down7.6

      \[\leadsto \color{blue}{{\left(\frac{\sqrt[3]{x + y} \cdot \sqrt[3]{x + y}}{x \cdot 2} \cdot \frac{\sqrt[3]{x + y}}{y}\right)}^{1}}\]
    9. Simplified0.1

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -1.392096079342848193007314734731115011171 \cdot 10^{-86} \lor \neg \left(y \le 5.173054498508759236112133194996942845024 \cdot 10^{-30}\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 2019306 
(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)))