Average Error: 7.8 → 7.8
Time: 3.4s
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 r565088 = x;
        double r565089 = y;
        double r565090 = r565088 + r565089;
        double r565091 = 1.0;
        double r565092 = z;
        double r565093 = r565089 / r565092;
        double r565094 = r565091 - r565093;
        double r565095 = r565090 / r565094;
        return r565095;
}

double f(double x, double y, double z) {
        double r565096 = x;
        double r565097 = y;
        double r565098 = r565096 + r565097;
        double r565099 = 1.0;
        double r565100 = z;
        double r565101 = r565097 / r565100;
        double r565102 = r565099 - r565101;
        double r565103 = r565098 / r565102;
        return r565103;
}

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

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

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

Reproduce

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