Average Error: 7.7 → 7.7
Time: 17.8s
Precision: 64
\[\frac{x + y}{1 - \frac{y}{z}}\]
\[\frac{y + x}{1 - \frac{y}{z}}\]
\frac{x + y}{1 - \frac{y}{z}}
\frac{y + x}{1 - \frac{y}{z}}
double f(double x, double y, double z) {
        double r433023 = x;
        double r433024 = y;
        double r433025 = r433023 + r433024;
        double r433026 = 1.0;
        double r433027 = z;
        double r433028 = r433024 / r433027;
        double r433029 = r433026 - r433028;
        double r433030 = r433025 / r433029;
        return r433030;
}

double f(double x, double y, double z) {
        double r433031 = y;
        double r433032 = x;
        double r433033 = r433031 + r433032;
        double r433034 = 1.0;
        double r433035 = z;
        double r433036 = r433031 / r433035;
        double r433037 = r433034 - r433036;
        double r433038 = r433033 / r433037;
        return r433038;
}

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
Target4.3
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. Using strategy rm
  3. Applied div-inv7.8

    \[\leadsto \color{blue}{\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}}\]
  4. Using strategy rm
  5. Applied pow17.8

    \[\leadsto \left(x + y\right) \cdot \color{blue}{{\left(\frac{1}{1 - \frac{y}{z}}\right)}^{1}}\]
  6. Applied pow17.8

    \[\leadsto \color{blue}{{\left(x + y\right)}^{1}} \cdot {\left(\frac{1}{1 - \frac{y}{z}}\right)}^{1}\]
  7. Applied pow-prod-down7.8

    \[\leadsto \color{blue}{{\left(\left(x + y\right) \cdot \frac{1}{1 - \frac{y}{z}}\right)}^{1}}\]
  8. Simplified7.7

    \[\leadsto {\color{blue}{\left(\frac{y + x}{1 - \frac{y}{z}}\right)}}^{1}\]
  9. Final simplification7.7

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

Reproduce

herbie shell --seed 2019199 
(FPCore (x y z)
  :name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"

  :herbie-target
  (if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))

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