Average Error: 3.6 → 0.8
Time: 10.7s
Precision: 64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\begin{array}{l} \mathbf{if}\;z \cdot 3 \le -1.357514163273684 \cdot 10^{34}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{1}{z \cdot \left(3 \cdot y\right)}}{\frac{1}{t}}\\ \mathbf{elif}\;z \cdot 3 \le 1.6202252690565565 \cdot 10^{139}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - 0.333333333333333315 \cdot \frac{y}{z}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array}\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\begin{array}{l}
\mathbf{if}\;z \cdot 3 \le -1.357514163273684 \cdot 10^{34}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{1}{z \cdot \left(3 \cdot y\right)}}{\frac{1}{t}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r492418 = x;
        double r492419 = y;
        double r492420 = z;
        double r492421 = 3.0;
        double r492422 = r492420 * r492421;
        double r492423 = r492419 / r492422;
        double r492424 = r492418 - r492423;
        double r492425 = t;
        double r492426 = r492422 * r492419;
        double r492427 = r492425 / r492426;
        double r492428 = r492424 + r492427;
        return r492428;
}

double f(double x, double y, double z, double t) {
        double r492429 = z;
        double r492430 = 3.0;
        double r492431 = r492429 * r492430;
        double r492432 = -1.357514163273684e+34;
        bool r492433 = r492431 <= r492432;
        double r492434 = x;
        double r492435 = y;
        double r492436 = r492435 / r492431;
        double r492437 = r492434 - r492436;
        double r492438 = 1.0;
        double r492439 = r492430 * r492435;
        double r492440 = r492429 * r492439;
        double r492441 = r492438 / r492440;
        double r492442 = t;
        double r492443 = r492438 / r492442;
        double r492444 = r492441 / r492443;
        double r492445 = r492437 + r492444;
        double r492446 = 1.6202252690565565e+139;
        bool r492447 = r492431 <= r492446;
        double r492448 = r492438 / r492431;
        double r492449 = r492442 / r492435;
        double r492450 = r492448 * r492449;
        double r492451 = r492437 + r492450;
        double r492452 = 0.3333333333333333;
        double r492453 = r492435 / r492429;
        double r492454 = r492452 * r492453;
        double r492455 = r492434 - r492454;
        double r492456 = r492431 * r492435;
        double r492457 = r492442 / r492456;
        double r492458 = r492455 + r492457;
        double r492459 = r492447 ? r492451 : r492458;
        double r492460 = r492433 ? r492445 : r492459;
        return r492460;
}

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

Derivation

  1. Split input into 3 regimes
  2. if (* z 3.0) < -1.357514163273684e+34

    1. Initial program 0.4

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied clear-num0.4

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\color{blue}{\left(\left(z \cdot 3\right) \cdot y\right) \cdot \frac{1}{t}}}\]
    6. Applied associate-/r*0.4

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

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

    if -1.357514163273684e+34 < (* z 3.0) < 1.6202252690565565e+139

    1. Initial program 6.6

      \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity6.6

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

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

    if 1.6202252690565565e+139 < (* z 3.0)

    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-/r*0.6

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

      \[\leadsto \left(x - \frac{\frac{y}{z}}{\color{blue}{\left(\sqrt[3]{3} \cdot \sqrt[3]{3}\right) \cdot \sqrt[3]{3}}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    6. Applied *-un-lft-identity0.6

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

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

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

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

      \[\leadsto \left(x - \color{blue}{\frac{1}{\sqrt[3]{3} \cdot \sqrt[3]{3}}} \cdot \frac{\frac{y}{z}}{\sqrt[3]{3}}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
    11. Taylor expanded around 0 0.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \le -1.357514163273684 \cdot 10^{34}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{1}{z \cdot \left(3 \cdot y\right)}}{\frac{1}{t}}\\ \mathbf{elif}\;z \cdot 3 \le 1.6202252690565565 \cdot 10^{139}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\ \mathbf{else}:\\ \;\;\;\;\left(x - 0.333333333333333315 \cdot \frac{y}{z}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\\ \end{array}\]

Reproduce

herbie shell --seed 2020043 +o rules:numerics
(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))))