Average Error: 15.2 → 0.2
Time: 8.3s
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 r356312 = x;
        double r356313 = 2.0;
        double r356314 = r356312 * r356313;
        double r356315 = y;
        double r356316 = r356314 * r356315;
        double r356317 = r356312 - r356315;
        double r356318 = r356316 / r356317;
        return r356318;
}

double f(double x, double y) {
        double r356319 = 1.0;
        double r356320 = 2.0;
        double r356321 = y;
        double r356322 = r356320 * r356321;
        double r356323 = r356319 / r356322;
        double r356324 = x;
        double r356325 = r356320 * r356324;
        double r356326 = r356319 / r356325;
        double r356327 = r356323 - r356326;
        double r356328 = r356319 / r356327;
        return r356328;
}

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)))