Average Error: 7.4 → 7.4
Time: 15.9s
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 r384160 = x;
        double r384161 = y;
        double r384162 = r384160 + r384161;
        double r384163 = 1.0;
        double r384164 = z;
        double r384165 = r384161 / r384164;
        double r384166 = r384163 - r384165;
        double r384167 = r384162 / r384166;
        return r384167;
}

double f(double x, double y, double z) {
        double r384168 = x;
        double r384169 = y;
        double r384170 = r384168 + r384169;
        double r384171 = 1.0;
        double r384172 = z;
        double r384173 = r384169 / r384172;
        double r384174 = r384171 - r384173;
        double r384175 = r384170 / r384174;
        return r384175;
}

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.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.4

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

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

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

Reproduce

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