Average Error: 20.3 → 7.5
Time: 5.7s
Precision: 64
\[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
\[\begin{array}{l} \mathbf{if}\;z \le -1.374430421261847883370663876711780992004 \cdot 10^{51} \lor \neg \left(z \le 1.170881853286825036164486846246290951967\right):\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}}} \cdot \frac{\sqrt[3]{x}}{\frac{c}{\sqrt[3]{y}}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \end{array}\]
\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}
\begin{array}{l}
\mathbf{if}\;z \le -1.374430421261847883370663876711780992004 \cdot 10^{51} \lor \neg \left(z \le 1.170881853286825036164486846246290951967\right):\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}}} \cdot \frac{\sqrt[3]{x}}{\frac{c}{\sqrt[3]{y}}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\

\mathbf{else}:\\
\;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r744694 = x;
        double r744695 = 9.0;
        double r744696 = r744694 * r744695;
        double r744697 = y;
        double r744698 = r744696 * r744697;
        double r744699 = z;
        double r744700 = 4.0;
        double r744701 = r744699 * r744700;
        double r744702 = t;
        double r744703 = r744701 * r744702;
        double r744704 = a;
        double r744705 = r744703 * r744704;
        double r744706 = r744698 - r744705;
        double r744707 = b;
        double r744708 = r744706 + r744707;
        double r744709 = c;
        double r744710 = r744699 * r744709;
        double r744711 = r744708 / r744710;
        return r744711;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r744712 = z;
        double r744713 = -1.3744304212618479e+51;
        bool r744714 = r744712 <= r744713;
        double r744715 = 1.170881853286825;
        bool r744716 = r744712 <= r744715;
        double r744717 = !r744716;
        bool r744718 = r744714 || r744717;
        double r744719 = b;
        double r744720 = c;
        double r744721 = r744712 * r744720;
        double r744722 = r744719 / r744721;
        double r744723 = 9.0;
        double r744724 = x;
        double r744725 = cbrt(r744724);
        double r744726 = r744725 * r744725;
        double r744727 = y;
        double r744728 = cbrt(r744727);
        double r744729 = r744728 * r744728;
        double r744730 = r744712 / r744729;
        double r744731 = r744726 / r744730;
        double r744732 = r744720 / r744728;
        double r744733 = r744725 / r744732;
        double r744734 = r744731 * r744733;
        double r744735 = r744723 * r744734;
        double r744736 = r744722 + r744735;
        double r744737 = 4.0;
        double r744738 = a;
        double r744739 = t;
        double r744740 = r744720 / r744739;
        double r744741 = r744738 / r744740;
        double r744742 = r744737 * r744741;
        double r744743 = r744736 - r744742;
        double r744744 = r744724 * r744727;
        double r744745 = r744744 / r744721;
        double r744746 = r744723 * r744745;
        double r744747 = r744722 + r744746;
        double r744748 = r744739 / r744720;
        double r744749 = r744738 * r744748;
        double r744750 = r744737 * r744749;
        double r744751 = r744747 - r744750;
        double r744752 = r744718 ? r744743 : r744751;
        return r744752;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original20.3
Target14.0
Herbie7.5
\[\begin{array}{l} \mathbf{if}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -1.100156740804105117061698089246936481893 \cdot 10^{-171}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt -0.0:\\ \;\;\;\;\frac{\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z}}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.170887791174748819600820354912645756062 \cdot 10^{-53}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 2.876823679546137226963937101710277849382 \cdot 10^{130}:\\ \;\;\;\;\left(\left(9 \cdot \frac{y}{c}\right) \cdot \frac{x}{z} + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \mathbf{elif}\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c} \lt 1.383851504245631860711731716196098366993 \cdot 10^{158}:\\ \;\;\;\;\frac{\left(\left(x \cdot 9\right) \cdot y - \left(z \cdot 4\right) \cdot \left(t \cdot a\right)\right) + b}{z \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\left(9 \cdot \left(\frac{y}{c \cdot z} \cdot x\right) + \frac{b}{c \cdot z}\right) - 4 \cdot \frac{a \cdot t}{c}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if z < -1.3744304212618479e+51 or 1.170881853286825 < z

    1. Initial program 31.0

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 13.6

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied associate-/l*14.3

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \color{blue}{\frac{a}{\frac{c}{t}}}\]
    5. Using strategy rm
    6. Applied associate-/l*11.6

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \color{blue}{\frac{x}{\frac{z \cdot c}{y}}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt11.7

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

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x}{\color{blue}{\frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{c}{\sqrt[3]{y}}}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]
    10. Applied add-cube-cbrt9.7

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}} \cdot \frac{c}{\sqrt[3]{y}}}\right) - 4 \cdot \frac{a}{\frac{c}{t}}\]
    11. Applied times-frac8.6

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

    if -1.3744304212618479e+51 < z < 1.170881853286825

    1. Initial program 6.9

      \[\frac{\left(\left(x \cdot 9\right) \cdot y - \left(\left(z \cdot 4\right) \cdot t\right) \cdot a\right) + b}{z \cdot c}\]
    2. Taylor expanded around 0 8.8

      \[\leadsto \color{blue}{\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{c}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity8.8

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \frac{a \cdot t}{\color{blue}{1 \cdot c}}\]
    5. Applied times-frac6.2

      \[\leadsto \left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \color{blue}{\left(\frac{a}{1} \cdot \frac{t}{c}\right)}\]
    6. Simplified6.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -1.374430421261847883370663876711780992004 \cdot 10^{51} \lor \neg \left(z \le 1.170881853286825036164486846246290951967\right):\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{z}{\sqrt[3]{y} \cdot \sqrt[3]{y}}} \cdot \frac{\sqrt[3]{x}}{\frac{c}{\sqrt[3]{y}}}\right)\right) - 4 \cdot \frac{a}{\frac{c}{t}}\\ \mathbf{else}:\\ \;\;\;\;\left(\frac{b}{z \cdot c} + 9 \cdot \frac{x \cdot y}{z \cdot c}\right) - 4 \cdot \left(a \cdot \frac{t}{c}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019354 
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, J"
  :precision binary64

  :herbie-target
  (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) -1.1001567408041051e-171) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) -0.0) (/ (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) z) c) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.1708877911747488e-53) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 2.876823679546137e+130) (- (+ (* (* 9 (/ y c)) (/ x z)) (/ b (* c z))) (* 4 (/ (* a t) c))) (if (< (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)) 1.3838515042456319e+158) (/ (+ (- (* (* x 9) y) (* (* z 4) (* t a))) b) (* z c)) (- (+ (* 9 (* (/ y (* c z)) x)) (/ b (* c z))) (* 4 (/ (* a t) c))))))))

  (/ (+ (- (* (* x 9) y) (* (* (* z 4) t) a)) b) (* z c)))