Average Error: 15.2 → 0.2
Time: 8.7s
Precision: 64
\[\frac{\left(x \cdot 2\right) \cdot y}{x - y}\]
\[\frac{1}{\frac{1}{2 \cdot y} - \frac{1}{2 \cdot x}}\]
\frac{\left(x \cdot 2\right) \cdot y}{x - y}
\frac{1}{\frac{1}{2 \cdot y} - \frac{1}{2 \cdot x}}
double f(double x, double y) {
        double r401901 = x;
        double r401902 = 2.0;
        double r401903 = r401901 * r401902;
        double r401904 = y;
        double r401905 = r401903 * r401904;
        double r401906 = r401901 - r401904;
        double r401907 = r401905 / r401906;
        return r401907;
}

double f(double x, double y) {
        double r401908 = 1.0;
        double r401909 = 2.0;
        double r401910 = y;
        double r401911 = r401909 * r401910;
        double r401912 = r401908 / r401911;
        double r401913 = x;
        double r401914 = r401909 * r401913;
        double r401915 = r401908 / r401914;
        double r401916 = r401912 - r401915;
        double r401917 = r401908 / r401916;
        return r401917;
}

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.3
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 15.2

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

    \[\leadsto \color{blue}{\frac{1}{\frac{x - y}{\left(x \cdot 2\right) \cdot y}}}\]
  4. Using strategy rm
  5. Applied div-sub15.6

    \[\leadsto \frac{1}{\color{blue}{\frac{x}{\left(x \cdot 2\right) \cdot y} - \frac{y}{\left(x \cdot 2\right) \cdot y}}}\]
  6. Simplified11.3

    \[\leadsto \frac{1}{\color{blue}{\frac{1}{2 \cdot y}} - \frac{y}{\left(x \cdot 2\right) \cdot y}}\]
  7. Simplified0.2

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

    \[\leadsto \frac{1}{\frac{1}{2 \cdot y} - \frac{1}{2 \cdot x}}\]

Reproduce

herbie shell --seed 2019303 
(FPCore (x y)
  :name "Linear.Projection:perspective from linear-1.19.1.3, B"
  :precision binary64

  :herbie-target
  (if (< x -1.7210442634149447e81) (* (/ (* 2 x) (- x y)) y) (if (< x 83645045635564432) (/ (* x 2) (/ (- x y) y)) (* (/ (* 2 x) (- x y)) y)))

  (/ (* (* x 2) y) (- x y)))