Average Error: 7.7 → 7.7
Time: 5.1s
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 r646059 = x;
        double r646060 = y;
        double r646061 = r646059 + r646060;
        double r646062 = 1.0;
        double r646063 = z;
        double r646064 = r646060 / r646063;
        double r646065 = r646062 - r646064;
        double r646066 = r646061 / r646065;
        return r646066;
}

double f(double x, double y, double z) {
        double r646067 = x;
        double r646068 = y;
        double r646069 = r646067 + r646068;
        double r646070 = 1.0;
        double r646071 = z;
        double r646072 = r646068 / r646071;
        double r646073 = r646070 - r646072;
        double r646074 = r646069 / r646073;
        return r646074;
}

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
Target4.2
Herbie7.7
\[\begin{array}{l} \mathbf{if}\;y \lt -3.74293107626898565 \cdot 10^{171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y \lt 3.55346624560867344 \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. Final simplification7.7

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

Reproduce

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

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

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