Average Error: 7.4 → 7.4
Time: 16.3s
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 r403715 = x;
        double r403716 = y;
        double r403717 = r403715 + r403716;
        double r403718 = 1.0;
        double r403719 = z;
        double r403720 = r403716 / r403719;
        double r403721 = r403718 - r403720;
        double r403722 = r403717 / r403721;
        return r403722;
}

double f(double x, double y, double z) {
        double r403723 = x;
        double r403724 = y;
        double r403725 = r403723 + r403724;
        double r403726 = 1.0;
        double r403727 = z;
        double r403728 = r403724 / r403727;
        double r403729 = r403726 - r403728;
        double r403730 = r403725 / r403729;
        return r403730;
}

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.2
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 2019196 
(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))))