Average Error: 7.6 → 7.6
Time: 10.7s
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 r696562 = x;
        double r696563 = y;
        double r696564 = r696562 + r696563;
        double r696565 = 1.0;
        double r696566 = z;
        double r696567 = r696563 / r696566;
        double r696568 = r696565 - r696567;
        double r696569 = r696564 / r696568;
        return r696569;
}

double f(double x, double y, double z) {
        double r696570 = x;
        double r696571 = y;
        double r696572 = r696570 + r696571;
        double r696573 = 1.0;
        double r696574 = z;
        double r696575 = r696571 / r696574;
        double r696576 = r696573 - r696575;
        double r696577 = r696572 / r696576;
        return r696577;
}

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.6
Target4.0
Herbie7.6
\[\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.6

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

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

Reproduce

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