Average Error: 3.4 → 0.4
Time: 12.3s
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 -53188386.55552358925342559814453125 \lor \neg \left(z \cdot 3 \le 7.577309234972421914586172099876946403791 \cdot 10^{-42}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot y}}{3}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{y}}{z \cdot 3}\\ \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 -53188386.55552358925342559814453125 \lor \neg \left(z \cdot 3 \le 7.577309234972421914586172099876946403791 \cdot 10^{-42}\right):\\
\;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot y}}{3}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r463990 = x;
        double r463991 = y;
        double r463992 = z;
        double r463993 = 3.0;
        double r463994 = r463992 * r463993;
        double r463995 = r463991 / r463994;
        double r463996 = r463990 - r463995;
        double r463997 = t;
        double r463998 = r463994 * r463991;
        double r463999 = r463997 / r463998;
        double r464000 = r463996 + r463999;
        return r464000;
}

double f(double x, double y, double z, double t) {
        double r464001 = z;
        double r464002 = 3.0;
        double r464003 = r464001 * r464002;
        double r464004 = -53188386.55552359;
        bool r464005 = r464003 <= r464004;
        double r464006 = 7.577309234972422e-42;
        bool r464007 = r464003 <= r464006;
        double r464008 = !r464007;
        bool r464009 = r464005 || r464008;
        double r464010 = x;
        double r464011 = y;
        double r464012 = r464011 / r464003;
        double r464013 = r464010 - r464012;
        double r464014 = t;
        double r464015 = r464001 * r464011;
        double r464016 = r464014 / r464015;
        double r464017 = r464016 / r464002;
        double r464018 = r464013 + r464017;
        double r464019 = r464014 / r464011;
        double r464020 = r464019 / r464003;
        double r464021 = r464013 + r464020;
        double r464022 = r464009 ? r464018 : r464021;
        return r464022;
}

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

Derivation

  1. Split input into 2 regimes
  2. if (* z 3.0) < -53188386.55552359 or 7.577309234972422e-42 < (* z 3.0)

    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 add-cube-cbrt0.7

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

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

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

      \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{{\left(\frac{\sqrt[3]{t} \cdot \sqrt[3]{t}}{z \cdot 3}\right)}^{1}} \cdot {\left(\frac{\sqrt[3]{t}}{y}\right)}^{1}\]
    8. Applied pow-prod-down1.8

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

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

    if -53188386.55552359 < (* z 3.0) < 7.577309234972422e-42

    1. Initial program 10.1

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \cdot 3 \le -53188386.55552358925342559814453125 \lor \neg \left(z \cdot 3 \le 7.577309234972421914586172099876946403791 \cdot 10^{-42}\right):\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot y}}{3}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{y}}{z \cdot 3}\\ \end{array}\]

Reproduce

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