Average Error: 3.9 → 0.4
Time: 7.0s
Precision: 64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;t \le -3.1361300744902736 \cdot 10^{22}:\\ \;\;\;\;x - \left(\frac{\frac{y}{z}}{3} - t \cdot \frac{\frac{1}{z \cdot 3}}{y}\right)\\ \mathbf{elif}\;t \le 5.46097822804766331 \cdot 10^{49}:\\ \;\;\;\;x - \left(\frac{\frac{y}{z}}{3} - \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\ \end{array}\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;t \le -3.1361300744902736 \cdot 10^{22}:\\
\;\;\;\;x - \left(\frac{\frac{y}{z}}{3} - t \cdot \frac{\frac{1}{z \cdot 3}}{y}\right)\\

\mathbf{elif}\;t \le 5.46097822804766331 \cdot 10^{49}:\\
\;\;\;\;x - \left(\frac{\frac{y}{z}}{3} - \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\right)\\

\mathbf{else}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r1308321 = x;
        double r1308322 = y;
        double r1308323 = z;
        double r1308324 = 3.0;
        double r1308325 = r1308323 * r1308324;
        double r1308326 = r1308322 / r1308325;
        double r1308327 = r1308321 - r1308326;
        double r1308328 = t;
        double r1308329 = r1308325 * r1308322;
        double r1308330 = r1308328 / r1308329;
        double r1308331 = r1308327 + r1308330;
        return r1308331;
}

double f(double x, double y, double z, double t) {
        double r1308332 = t;
        double r1308333 = -3.1361300744902736e+22;
        bool r1308334 = r1308332 <= r1308333;
        double r1308335 = x;
        double r1308336 = y;
        double r1308337 = z;
        double r1308338 = r1308336 / r1308337;
        double r1308339 = 3.0;
        double r1308340 = r1308338 / r1308339;
        double r1308341 = 1.0;
        double r1308342 = r1308337 * r1308339;
        double r1308343 = r1308341 / r1308342;
        double r1308344 = r1308343 / r1308336;
        double r1308345 = r1308332 * r1308344;
        double r1308346 = r1308340 - r1308345;
        double r1308347 = r1308335 - r1308346;
        double r1308348 = 5.460978228047663e+49;
        bool r1308349 = r1308332 <= r1308348;
        double r1308350 = r1308341 / r1308337;
        double r1308351 = r1308332 / r1308339;
        double r1308352 = r1308351 / r1308336;
        double r1308353 = r1308350 * r1308352;
        double r1308354 = r1308340 - r1308353;
        double r1308355 = r1308335 - r1308354;
        double r1308356 = r1308336 / r1308342;
        double r1308357 = r1308335 - r1308356;
        double r1308358 = r1308339 * r1308336;
        double r1308359 = r1308337 * r1308358;
        double r1308360 = r1308332 / r1308359;
        double r1308361 = r1308357 + r1308360;
        double r1308362 = r1308349 ? r1308355 : r1308361;
        double r1308363 = r1308334 ? r1308347 : r1308362;
        return r1308363;
}

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.9
Target1.7
Herbie0.4
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -3.1361300744902736e+22

    1. Initial program 0.5

      \[\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*2.7

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{\frac{t}{z \cdot 3}}{y}}\]
    4. Using strategy rm
    5. Applied associate-/r*2.7

      \[\leadsto \left(x - \color{blue}{\frac{\frac{y}{z}}{3}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
    6. Using strategy rm
    7. Applied associate-+l-2.7

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

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

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

      \[\leadsto x - \left(\frac{\frac{y}{z}}{3} - \color{blue}{\frac{t}{1} \cdot \frac{\frac{1}{z \cdot 3}}{y}}\right)\]
    12. Simplified0.4

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

    if -3.1361300744902736e+22 < t < 5.460978228047663e+49

    1. Initial program 5.8

      \[\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.1

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{\frac{t}{z \cdot 3}}{y}}\]
    4. Using strategy rm
    5. Applied associate-/r*1.1

      \[\leadsto \left(x - \color{blue}{\frac{\frac{y}{z}}{3}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
    6. Using strategy rm
    7. Applied associate-+l-1.1

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

      \[\leadsto x - \left(\frac{\frac{y}{z}}{3} - \frac{\frac{t}{z \cdot 3}}{\color{blue}{1 \cdot y}}\right)\]
    10. Applied *-un-lft-identity1.1

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

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

      \[\leadsto x - \left(\frac{\frac{y}{z}}{3} - \color{blue}{\frac{\frac{1}{z}}{1} \cdot \frac{\frac{t}{3}}{y}}\right)\]
    13. Simplified0.3

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

    if 5.460978228047663e+49 < t

    1. Initial program 0.6

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\color{blue}{z \cdot \left(3 \cdot y\right)}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -3.1361300744902736 \cdot 10^{22}:\\ \;\;\;\;x - \left(\frac{\frac{y}{z}}{3} - t \cdot \frac{\frac{1}{z \cdot 3}}{y}\right)\\ \mathbf{elif}\;t \le 5.46097822804766331 \cdot 10^{49}:\\ \;\;\;\;x - \left(\frac{\frac{y}{z}}{3} - \frac{1}{z} \cdot \frac{\frac{t}{3}}{y}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{z \cdot \left(3 \cdot y\right)}\\ \end{array}\]

Reproduce

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