Average Error: 7.5 → 7.5
Time: 21.7s
Precision: 64
\[\frac{x + y}{1 - \frac{y}{z}}\]
\[\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}\]
\frac{x + y}{1 - \frac{y}{z}}
\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}
double f(double x, double y, double z) {
        double r497576 = x;
        double r497577 = y;
        double r497578 = r497576 + r497577;
        double r497579 = 1.0;
        double r497580 = z;
        double r497581 = r497577 / r497580;
        double r497582 = r497579 - r497581;
        double r497583 = r497578 / r497582;
        return r497583;
}

double f(double x, double y, double z) {
        double r497584 = x;
        double r497585 = y;
        double r497586 = r497584 + r497585;
        double r497587 = 1.0;
        double r497588 = 1.0;
        double r497589 = z;
        double r497590 = r497585 / r497589;
        double r497591 = r497588 - r497590;
        double r497592 = r497587 / r497591;
        double r497593 = r497586 * r497592;
        return r497593;
}

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.5
Target3.9
Herbie7.5
\[\begin{array}{l} \mathbf{if}\;y \lt -3.742931076268985646434612946949172132145 \cdot 10^{171}:\\ \;\;\;\;\frac{y + x}{-y} \cdot z\\ \mathbf{elif}\;y \lt 3.553466245608673435460441960303815115662 \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.5

    \[\frac{x + y}{1 - \frac{y}{z}}\]
  2. Using strategy rm
  3. Applied div-inv7.5

    \[\leadsto \color{blue}{\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}}\]
  4. Final simplification7.5

    \[\leadsto \left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}\]

Reproduce

herbie shell --seed 2019209 +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.74293107626898565e171) (* (/ (+ y x) (- y)) z) (if (< y 3.55346624560867344e168) (/ (+ x y) (- 1 (/ y z))) (* (/ (+ y x) (- y)) z)))

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