Average Error: 7.8 → 7.8
Time: 15.2s
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 r517565 = x;
        double r517566 = y;
        double r517567 = r517565 + r517566;
        double r517568 = 1.0;
        double r517569 = z;
        double r517570 = r517566 / r517569;
        double r517571 = r517568 - r517570;
        double r517572 = r517567 / r517571;
        return r517572;
}

double f(double x, double y, double z) {
        double r517573 = x;
        double r517574 = y;
        double r517575 = r517573 + r517574;
        double r517576 = 1.0;
        double r517577 = z;
        double r517578 = r517574 / r517577;
        double r517579 = r517576 - r517578;
        double r517580 = r517575 / r517579;
        return r517580;
}

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.8
Target4.1
Herbie7.8
\[\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.8

    \[\frac{x + y}{1 - \frac{y}{z}}\]
  2. Simplified7.8

    \[\leadsto \color{blue}{\frac{y + x}{1 - \frac{y}{z}}}\]
  3. Final simplification7.8

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

Reproduce

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

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

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