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 r717659 = x;
        double r717660 = y;
        double r717661 = r717659 + r717660;
        double r717662 = 1.0;
        double r717663 = z;
        double r717664 = r717660 / r717663;
        double r717665 = r717662 - r717664;
        double r717666 = r717661 / r717665;
        return r717666;
}

double f(double x, double y, double z) {
        double r717667 = x;
        double r717668 = y;
        double r717669 = r717667 + r717668;
        double r717670 = 1.0;
        double r717671 = z;
        double r717672 = r717668 / r717671;
        double r717673 = r717670 - r717672;
        double r717674 = r717669 / r717673;
        return r717674;
}

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.3
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 2020060 
(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))))