Average Error: 7.7 → 7.7
Time: 13.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 r485188 = x;
        double r485189 = y;
        double r485190 = r485188 + r485189;
        double r485191 = 1.0;
        double r485192 = z;
        double r485193 = r485189 / r485192;
        double r485194 = r485191 - r485193;
        double r485195 = r485190 / r485194;
        return r485195;
}

double f(double x, double y, double z) {
        double r485196 = x;
        double r485197 = y;
        double r485198 = r485196 + r485197;
        double r485199 = 1.0;
        double r485200 = z;
        double r485201 = r485197 / r485200;
        double r485202 = r485199 - r485201;
        double r485203 = r485198 / r485202;
        return r485203;
}

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

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

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

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

Reproduce

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