Average Error: 3.9 → 0.4
Time: 7.1s
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 r877806 = x;
        double r877807 = y;
        double r877808 = z;
        double r877809 = 3.0;
        double r877810 = r877808 * r877809;
        double r877811 = r877807 / r877810;
        double r877812 = r877806 - r877811;
        double r877813 = t;
        double r877814 = r877810 * r877807;
        double r877815 = r877813 / r877814;
        double r877816 = r877812 + r877815;
        return r877816;
}

double f(double x, double y, double z, double t) {
        double r877817 = t;
        double r877818 = -3.1361300744902736e+22;
        bool r877819 = r877817 <= r877818;
        double r877820 = x;
        double r877821 = y;
        double r877822 = z;
        double r877823 = r877821 / r877822;
        double r877824 = 3.0;
        double r877825 = r877823 / r877824;
        double r877826 = 1.0;
        double r877827 = r877822 * r877824;
        double r877828 = r877826 / r877827;
        double r877829 = r877828 / r877821;
        double r877830 = r877817 * r877829;
        double r877831 = r877825 - r877830;
        double r877832 = r877820 - r877831;
        double r877833 = 5.460978228047663e+49;
        bool r877834 = r877817 <= r877833;
        double r877835 = r877826 / r877822;
        double r877836 = r877817 / r877824;
        double r877837 = r877836 / r877821;
        double r877838 = r877835 * r877837;
        double r877839 = r877825 - r877838;
        double r877840 = r877820 - r877839;
        double r877841 = r877821 / r877827;
        double r877842 = r877820 - r877841;
        double r877843 = r877824 * r877821;
        double r877844 = r877822 * r877843;
        double r877845 = r877817 / r877844;
        double r877846 = r877842 + r877845;
        double r877847 = r877834 ? r877840 : r877846;
        double r877848 = r877819 ? r877832 : r877847;
        return r877848;
}

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))))