Average Error: 14.6 → 0.2
Time: 22.6s
Precision: 64
\[\frac{\left(x \cdot 2\right) \cdot y}{x - y}\]
\[\frac{1}{\frac{0.5}{y} - \frac{0.5}{x}}\]
\frac{\left(x \cdot 2\right) \cdot y}{x - y}
\frac{1}{\frac{0.5}{y} - \frac{0.5}{x}}
double f(double x, double y) {
        double r21255892 = x;
        double r21255893 = 2.0;
        double r21255894 = r21255892 * r21255893;
        double r21255895 = y;
        double r21255896 = r21255894 * r21255895;
        double r21255897 = r21255892 - r21255895;
        double r21255898 = r21255896 / r21255897;
        return r21255898;
}

double f(double x, double y) {
        double r21255899 = 1.0;
        double r21255900 = 0.5;
        double r21255901 = y;
        double r21255902 = r21255900 / r21255901;
        double r21255903 = x;
        double r21255904 = r21255900 / r21255903;
        double r21255905 = r21255902 - r21255904;
        double r21255906 = r21255899 / r21255905;
        return r21255906;
}

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.6
Target0.4
Herbie0.2
\[\begin{array}{l} \mathbf{if}\;x \lt -1.721044263414944729490876394165887012892 \cdot 10^{81}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \mathbf{elif}\;x \lt 83645045635564432:\\ \;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot x}{x - y} \cdot y\\ \end{array}\]

Derivation

  1. Initial program 14.6

    \[\frac{\left(x \cdot 2\right) \cdot y}{x - y}\]
  2. Using strategy rm
  3. Applied clear-num14.8

    \[\leadsto \color{blue}{\frac{1}{\frac{x - y}{\left(x \cdot 2\right) \cdot y}}}\]
  4. Taylor expanded around 0 0.2

    \[\leadsto \frac{1}{\color{blue}{0.5 \cdot \frac{1}{y} - 0.5 \cdot \frac{1}{x}}}\]
  5. Simplified0.2

    \[\leadsto \frac{1}{\color{blue}{\frac{0.5}{y} - \frac{0.5}{x}}}\]
  6. Final simplification0.2

    \[\leadsto \frac{1}{\frac{0.5}{y} - \frac{0.5}{x}}\]

Reproduce

herbie shell --seed 2019200 +o rules:numerics
(FPCore (x y)
  :name "Linear.Projection:perspective from linear-1.19.1.3, B"

  :herbie-target
  (if (< x -1.7210442634149447e+81) (* (/ (* 2.0 x) (- x y)) y) (if (< x 8.364504563556443e+16) (/ (* x 2.0) (/ (- x y) y)) (* (/ (* 2.0 x) (- x y)) y)))

  (/ (* (* x 2.0) y) (- x y)))