Average Error: 3.9 → 1.8
Time: 6.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 -3.7755561996985703 \cdot 10^{108} \lor \neg \left(z \cdot 3 \le 46434150027.623123\right):\\ \;\;\;\;\left(\sqrt[3]{\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}} \cdot \sqrt[3]{\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}}\right) \cdot \sqrt[3]{\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}}\\ \mathbf{else}:\\ \;\;\;\;\left(x - \frac{y}{z \cdot 3}\right) + \frac{1}{z \cdot 3} \cdot \frac{t}{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 -3.7755561996985703 \cdot 10^{108} \lor \neg \left(z \cdot 3 \le 46434150027.623123\right):\\
\;\;\;\;\left(\sqrt[3]{\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}} \cdot \sqrt[3]{\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}}\right) \cdot \sqrt[3]{\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r763101 = x;
        double r763102 = y;
        double r763103 = z;
        double r763104 = 3.0;
        double r763105 = r763103 * r763104;
        double r763106 = r763102 / r763105;
        double r763107 = r763101 - r763106;
        double r763108 = t;
        double r763109 = r763105 * r763102;
        double r763110 = r763108 / r763109;
        double r763111 = r763107 + r763110;
        return r763111;
}

double f(double x, double y, double z, double t) {
        double r763112 = z;
        double r763113 = 3.0;
        double r763114 = r763112 * r763113;
        double r763115 = -3.7755561996985703e+108;
        bool r763116 = r763114 <= r763115;
        double r763117 = 46434150027.62312;
        bool r763118 = r763114 <= r763117;
        double r763119 = !r763118;
        bool r763120 = r763116 || r763119;
        double r763121 = x;
        double r763122 = y;
        double r763123 = r763122 / r763114;
        double r763124 = r763121 - r763123;
        double r763125 = t;
        double r763126 = r763125 / r763114;
        double r763127 = r763126 / r763122;
        double r763128 = r763124 + r763127;
        double r763129 = cbrt(r763128);
        double r763130 = r763129 * r763129;
        double r763131 = r763130 * r763129;
        double r763132 = 1.0;
        double r763133 = r763132 / r763114;
        double r763134 = r763125 / r763122;
        double r763135 = r763133 * r763134;
        double r763136 = r763124 + r763135;
        double r763137 = r763120 ? r763131 : r763136;
        return r763137;
}

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
Herbie1.8
\[\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) < -3.7755561996985703e+108 or 46434150027.62312 < (* z 3.0)

    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 associate-/r*1.2

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

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

    if -3.7755561996985703e+108 < (* z 3.0) < 46434150027.62312

    1. Initial program 8.0

      \[\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-identity8.0

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

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

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

Reproduce

herbie shell --seed 2020035 +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))))