Average Error: 3.6 → 0.6
Time: 3.6s
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.47025786267833131 \cdot 10^{34}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\frac{\left(z \cdot 3\right) \cdot y}{t}}\\ \mathbf{elif}\;z \cdot 3 \le 5.67346849327476735 \cdot 10^{-85}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\ \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}\;z \cdot 3 \le -1.47025786267833131 \cdot 10^{34}:\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\frac{\left(z \cdot 3\right) \cdot y}{t}}\\

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

\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 r925763 = x;
        double r925764 = y;
        double r925765 = z;
        double r925766 = 3.0;
        double r925767 = r925765 * r925766;
        double r925768 = r925764 / r925767;
        double r925769 = r925763 - r925768;
        double r925770 = t;
        double r925771 = r925767 * r925764;
        double r925772 = r925770 / r925771;
        double r925773 = r925769 + r925772;
        return r925773;
}

double f(double x, double y, double z, double t) {
        double r925774 = z;
        double r925775 = 3.0;
        double r925776 = r925774 * r925775;
        double r925777 = -1.4702578626783313e+34;
        bool r925778 = r925776 <= r925777;
        double r925779 = x;
        double r925780 = y;
        double r925781 = r925780 / r925776;
        double r925782 = r925779 - r925781;
        double r925783 = 1.0;
        double r925784 = r925776 * r925780;
        double r925785 = t;
        double r925786 = r925784 / r925785;
        double r925787 = r925783 / r925786;
        double r925788 = r925782 + r925787;
        double r925789 = 5.673468493274767e-85;
        bool r925790 = r925776 <= r925789;
        double r925791 = r925783 / r925776;
        double r925792 = r925785 / r925780;
        double r925793 = r925791 * r925792;
        double r925794 = r925782 + r925793;
        double r925795 = r925775 * r925780;
        double r925796 = r925774 * r925795;
        double r925797 = r925785 / r925796;
        double r925798 = r925782 + r925797;
        double r925799 = r925790 ? r925794 : r925798;
        double r925800 = r925778 ? r925788 : r925799;
        return r925800;
}

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.9
Herbie0.6
\[\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.4702578626783313e+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}}}\]

    if -1.4702578626783313e+34 < (* z 3.0) < 5.673468493274767e-85

    1. Initial program 10.5

      \[\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-identity10.5

      \[\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-frac0.4

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

    if 5.673468493274767e-85 < (* z 3.0)

    1. Initial program 0.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \le -1.47025786267833131 \cdot 10^{34}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{\frac{\left(z \cdot 3\right) \cdot y}{t}}\\ \mathbf{elif}\;z \cdot 3 \le 5.67346849327476735 \cdot 10^{-85}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{y}\\ \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 2020056 
(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))))