Average Error: 3.4 → 1.8
Time: 3.3s
Precision: 64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\left(x - \frac{1}{z \cdot \frac{3}{y}}\right) + \frac{t}{z \cdot 3} \cdot \frac{1}{y}\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\left(x - \frac{1}{z \cdot \frac{3}{y}}\right) + \frac{t}{z \cdot 3} \cdot \frac{1}{y}
double f(double x, double y, double z, double t) {
        double r744501 = x;
        double r744502 = y;
        double r744503 = z;
        double r744504 = 3.0;
        double r744505 = r744503 * r744504;
        double r744506 = r744502 / r744505;
        double r744507 = r744501 - r744506;
        double r744508 = t;
        double r744509 = r744505 * r744502;
        double r744510 = r744508 / r744509;
        double r744511 = r744507 + r744510;
        return r744511;
}

double f(double x, double y, double z, double t) {
        double r744512 = x;
        double r744513 = 1.0;
        double r744514 = z;
        double r744515 = 3.0;
        double r744516 = y;
        double r744517 = r744515 / r744516;
        double r744518 = r744514 * r744517;
        double r744519 = r744513 / r744518;
        double r744520 = r744512 - r744519;
        double r744521 = t;
        double r744522 = r744514 * r744515;
        double r744523 = r744521 / r744522;
        double r744524 = r744513 / r744516;
        double r744525 = r744523 * r744524;
        double r744526 = r744520 + r744525;
        return r744526;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.4
Target1.8
Herbie1.8
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Initial program 3.4

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
  2. Using strategy rm
  3. Applied associate-/r*1.8

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

    \[\leadsto \left(x - \color{blue}{\frac{1}{\frac{z \cdot 3}{y}}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity1.8

    \[\leadsto \left(x - \frac{1}{\frac{z \cdot 3}{\color{blue}{1 \cdot y}}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
  8. Applied times-frac1.8

    \[\leadsto \left(x - \frac{1}{\color{blue}{\frac{z}{1} \cdot \frac{3}{y}}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
  9. Simplified1.8

    \[\leadsto \left(x - \frac{1}{\color{blue}{z} \cdot \frac{3}{y}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
  10. Using strategy rm
  11. Applied div-inv1.8

    \[\leadsto \left(x - \frac{1}{z \cdot \frac{3}{y}}\right) + \color{blue}{\frac{t}{z \cdot 3} \cdot \frac{1}{y}}\]
  12. Final simplification1.8

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

Reproduce

herbie shell --seed 2020003 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"
  :precision binary64

  :herbie-target
  (+ (- x (/ y (* z 3))) (/ (/ t (* z 3)) y))

  (+ (- x (/ y (* z 3))) (/ t (* (* z 3) y))))