Average Error: 7.5 → 7.5
Time: 15.2s
Precision: 64
\[\frac{x + y}{1 - \frac{y}{z}}\]
\[\frac{y + x}{1 - \frac{y}{z}}\]
\frac{x + y}{1 - \frac{y}{z}}
\frac{y + x}{1 - \frac{y}{z}}
double f(double x, double y, double z) {
        double r36997615 = x;
        double r36997616 = y;
        double r36997617 = r36997615 + r36997616;
        double r36997618 = 1.0;
        double r36997619 = z;
        double r36997620 = r36997616 / r36997619;
        double r36997621 = r36997618 - r36997620;
        double r36997622 = r36997617 / r36997621;
        return r36997622;
}

double f(double x, double y, double z) {
        double r36997623 = y;
        double r36997624 = x;
        double r36997625 = r36997623 + r36997624;
        double r36997626 = 1.0;
        double r36997627 = z;
        double r36997628 = r36997623 / r36997627;
        double r36997629 = r36997626 - r36997628;
        double r36997630 = r36997625 / r36997629;
        return r36997630;
}

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.5
Target4.2
Herbie7.5
\[\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.5

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

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

Reproduce

herbie shell --seed 2019171 
(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))))