Average Error: 7.4 → 7.4
Time: 4.5s
Precision: 64
\[\frac{x + y}{1 - \frac{y}{z}}\]
\[\frac{x + y}{1 - \frac{y}{z}}\]
\frac{x + y}{1 - \frac{y}{z}}
\frac{x + y}{1 - \frac{y}{z}}
double f(double x, double y, double z) {
        double r623950 = x;
        double r623951 = y;
        double r623952 = r623950 + r623951;
        double r623953 = 1.0;
        double r623954 = z;
        double r623955 = r623951 / r623954;
        double r623956 = r623953 - r623955;
        double r623957 = r623952 / r623956;
        return r623957;
}

double f(double x, double y, double z) {
        double r623958 = x;
        double r623959 = y;
        double r623960 = r623958 + r623959;
        double r623961 = 1.0;
        double r623962 = z;
        double r623963 = r623959 / r623962;
        double r623964 = r623961 - r623963;
        double r623965 = r623960 / r623964;
        return r623965;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original7.4
Target4.0
Herbie7.4
\[\begin{array}{l} \mathbf{if}\;y \lt -3.74293107626898565 \cdot 10^{171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y \lt 3.55346624560867344 \cdot 10^{168}:\\ \;\;\;\;\frac{x + y}{1 - \frac{y}{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \end{array}\]

Derivation

  1. Initial program 7.4

    \[\frac{x + y}{1 - \frac{y}{z}}\]
  2. Final simplification7.4

    \[\leadsto \frac{x + y}{1 - \frac{y}{z}}\]

Reproduce

herbie shell --seed 2020024 
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
  :precision binary64

  :herbie-target
  (if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1 (/ y z))) (* (/ (+ y x) (- y)) z)))

  (/ (+ x y) (- 1 (/ y z))))