Average Error: 20.7 → 8.1
Time: 26.0s
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 -3.972382339916756952166028272029685653784 \cdot 10^{73}:\\ \;\;\;\;\mathsf{fma}\left(9, \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}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;z \le 229091558.659164011478424072265625:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t}{\frac{c}{a}}\\ \mathbf{elif}\;z \le 2.258247896998519207364538961474114070293 \cdot 10^{272}:\\ \;\;\;\;\mathsf{fma}\left(9, \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}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right) - 4 \cdot \left(t \cdot \frac{a}{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 -3.972382339916756952166028272029685653784 \cdot 10^{73}:\\
\;\;\;\;\mathsf{fma}\left(9, \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}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\\

\mathbf{elif}\;z \le 229091558.659164011478424072265625:\\
\;\;\;\;\mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t}{\frac{c}{a}}\\

\mathbf{elif}\;z \le 2.258247896998519207364538961474114070293 \cdot 10^{272}:\\
\;\;\;\;\mathsf{fma}\left(9, \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}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\\

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

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c) {
        double r87252667 = x;
        double r87252668 = 9.0;
        double r87252669 = r87252667 * r87252668;
        double r87252670 = y;
        double r87252671 = r87252669 * r87252670;
        double r87252672 = z;
        double r87252673 = 4.0;
        double r87252674 = r87252672 * r87252673;
        double r87252675 = t;
        double r87252676 = r87252674 * r87252675;
        double r87252677 = a;
        double r87252678 = r87252676 * r87252677;
        double r87252679 = r87252671 - r87252678;
        double r87252680 = b;
        double r87252681 = r87252679 + r87252680;
        double r87252682 = c;
        double r87252683 = r87252672 * r87252682;
        double r87252684 = r87252681 / r87252683;
        return r87252684;
}

double f(double x, double y, double z, double t, double a, double b, double c) {
        double r87252685 = z;
        double r87252686 = -3.972382339916757e+73;
        bool r87252687 = r87252685 <= r87252686;
        double r87252688 = 9.0;
        double r87252689 = x;
        double r87252690 = cbrt(r87252689);
        double r87252691 = r87252690 * r87252690;
        double r87252692 = y;
        double r87252693 = cbrt(r87252692);
        double r87252694 = r87252693 * r87252693;
        double r87252695 = r87252685 / r87252694;
        double r87252696 = r87252691 / r87252695;
        double r87252697 = c;
        double r87252698 = r87252697 / r87252693;
        double r87252699 = r87252690 / r87252698;
        double r87252700 = r87252696 * r87252699;
        double r87252701 = b;
        double r87252702 = r87252685 * r87252697;
        double r87252703 = r87252701 / r87252702;
        double r87252704 = fma(r87252688, r87252700, r87252703);
        double r87252705 = 4.0;
        double r87252706 = t;
        double r87252707 = a;
        double r87252708 = r87252706 * r87252707;
        double r87252709 = r87252708 / r87252697;
        double r87252710 = r87252705 * r87252709;
        double r87252711 = r87252704 - r87252710;
        double r87252712 = 229091558.659164;
        bool r87252713 = r87252685 <= r87252712;
        double r87252714 = r87252702 / r87252692;
        double r87252715 = r87252689 / r87252714;
        double r87252716 = fma(r87252688, r87252715, r87252703);
        double r87252717 = r87252697 / r87252707;
        double r87252718 = r87252706 / r87252717;
        double r87252719 = r87252705 * r87252718;
        double r87252720 = r87252716 - r87252719;
        double r87252721 = 2.2582478969985192e+272;
        bool r87252722 = r87252685 <= r87252721;
        double r87252723 = r87252707 / r87252697;
        double r87252724 = r87252706 * r87252723;
        double r87252725 = r87252705 * r87252724;
        double r87252726 = r87252716 - r87252725;
        double r87252727 = r87252722 ? r87252711 : r87252726;
        double r87252728 = r87252713 ? r87252720 : r87252727;
        double r87252729 = r87252687 ? r87252711 : r87252728;
        return r87252729;
}

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

Target

Original20.7
Target14.9
Herbie8.1
\[\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.100156740804104887233830094663413900721 \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 3 regimes
  2. if z < -3.972382339916757e+73 or 229091558.659164 < z < 2.2582478969985192e+272

    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. Simplified8.8

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{z} - \left(a \cdot t\right) \cdot 4}{c}}\]
    3. Taylor expanded around 0 13.7

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(9, \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}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\]
    11. Applied times-frac8.4

      \[\leadsto \mathsf{fma}\left(9, \color{blue}{\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}}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\]

    if -3.972382339916757e+73 < z < 229091558.659164

    1. Initial program 7.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. Simplified18.4

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{z} - \left(a \cdot t\right) \cdot 4}{c}}\]
    3. Taylor expanded around 0 9.6

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

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

      \[\leadsto \mathsf{fma}\left(9, \color{blue}{\frac{x}{\frac{z \cdot c}{y}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\]
    7. Using strategy rm
    8. Applied associate-/l*7.3

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

    if 2.2582478969985192e+272 < z

    1. Initial program 46.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. Simplified13.1

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(x \cdot 9, y, b\right)}{z} - \left(a \cdot t\right) \cdot 4}{c}}\]
    3. Taylor expanded around 0 16.5

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

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

      \[\leadsto \mathsf{fma}\left(9, \color{blue}{\frac{x}{\frac{z \cdot c}{y}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity13.1

      \[\leadsto \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{\color{blue}{1 \cdot c}}\]
    9. Applied times-frac12.8

      \[\leadsto \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right) - 4 \cdot \color{blue}{\left(\frac{t}{1} \cdot \frac{a}{c}\right)}\]
    10. Simplified12.8

      \[\leadsto \mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right) - 4 \cdot \left(\color{blue}{t} \cdot \frac{a}{c}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification8.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -3.972382339916756952166028272029685653784 \cdot 10^{73}:\\ \;\;\;\;\mathsf{fma}\left(9, \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}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\\ \mathbf{elif}\;z \le 229091558.659164011478424072265625:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t}{\frac{c}{a}}\\ \mathbf{elif}\;z \le 2.258247896998519207364538961474114070293 \cdot 10^{272}:\\ \;\;\;\;\mathsf{fma}\left(9, \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}}}, \frac{b}{z \cdot c}\right) - 4 \cdot \frac{t \cdot a}{c}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(9, \frac{x}{\frac{z \cdot c}{y}}, \frac{b}{z \cdot c}\right) - 4 \cdot \left(t \cdot \frac{a}{c}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019173 +o rules:numerics
(FPCore (x y z t a b c)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, J"

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

  (/ (+ (- (* (* x 9.0) y) (* (* (* z 4.0) t) a)) b) (* z c)))