Average Error: 7.7 → 7.7
Time: 3.2s
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 r743665 = x;
        double r743666 = y;
        double r743667 = r743665 + r743666;
        double r743668 = 1.0;
        double r743669 = z;
        double r743670 = r743666 / r743669;
        double r743671 = r743668 - r743670;
        double r743672 = r743667 / r743671;
        return r743672;
}

double f(double x, double y, double z) {
        double r743673 = x;
        double r743674 = y;
        double r743675 = r743673 + r743674;
        double r743676 = 1.0;
        double r743677 = z;
        double r743678 = r743674 / r743677;
        double r743679 = r743676 - r743678;
        double r743680 = r743675 / r743679;
        return r743680;
}

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
Target3.9
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 2020020 +o rules:numerics
(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))))