Average Error: 7.6 → 7.6
Time: 22.0s
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 r452239 = x;
        double r452240 = y;
        double r452241 = r452239 + r452240;
        double r452242 = 1.0;
        double r452243 = z;
        double r452244 = r452240 / r452243;
        double r452245 = r452242 - r452244;
        double r452246 = r452241 / r452245;
        return r452246;
}

double f(double x, double y, double z) {
        double r452247 = x;
        double r452248 = y;
        double r452249 = r452247 + r452248;
        double r452250 = 1.0;
        double r452251 = z;
        double r452252 = r452248 / r452251;
        double r452253 = r452250 - r452252;
        double r452254 = r452249 / r452253;
        return r452254;
}

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.6
Target4.0
Herbie7.6
\[\begin{array}{l} \mathbf{if}\;y \lt -3.742931076268985646434612946949172132145 \cdot 10^{171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y \lt 3.553466245608673435460441960303815115662 \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.6

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

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

Reproduce

herbie shell --seed 2019347 +o rules:numerics
(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))))