Average Error: 5.9 → 3.1
Time: 26.4s
Precision: 64
\[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k\]
\[\begin{array}{l} \mathbf{if}\;t \le -7.497416902329217719773679954021670957821 \cdot 10^{-90}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(\left(\left(18 \cdot y\right) \cdot x\right) \cdot z\right) \cdot t - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), 27 \cdot \left(j \cdot k\right)\right)\right)\\ \mathbf{elif}\;t \le 8.621654608286013508351055408676881547749 \cdot 10^{-206}:\\ \;\;\;\;\mathsf{fma}\left(b, c, z \cdot \left(\left(x \cdot t\right) \cdot \left(18 \cdot y\right)\right) - \sqrt[3]{\mathsf{fma}\left(j, k \cdot 27, \mathsf{fma}\left(x, i, t \cdot a\right) \cdot 4\right)} \cdot \left(\sqrt[3]{\mathsf{fma}\left(j, k \cdot 27, \mathsf{fma}\left(x, i, t \cdot a\right) \cdot 4\right)} \cdot \sqrt[3]{\mathsf{fma}\left(j, k \cdot 27, \mathsf{fma}\left(x, i, t \cdot a\right) \cdot 4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, t \cdot \left(\left(\left(18 \cdot x\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), \left(\left(k \cdot \sqrt{27}\right) \cdot j\right) \cdot \sqrt{27}\right)\right)\\ \end{array}\]
\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k
\begin{array}{l}
\mathbf{if}\;t \le -7.497416902329217719773679954021670957821 \cdot 10^{-90}:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(\left(\left(18 \cdot y\right) \cdot x\right) \cdot z\right) \cdot t - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), 27 \cdot \left(j \cdot k\right)\right)\right)\\

\mathbf{elif}\;t \le 8.621654608286013508351055408676881547749 \cdot 10^{-206}:\\
\;\;\;\;\mathsf{fma}\left(b, c, z \cdot \left(\left(x \cdot t\right) \cdot \left(18 \cdot y\right)\right) - \sqrt[3]{\mathsf{fma}\left(j, k \cdot 27, \mathsf{fma}\left(x, i, t \cdot a\right) \cdot 4\right)} \cdot \left(\sqrt[3]{\mathsf{fma}\left(j, k \cdot 27, \mathsf{fma}\left(x, i, t \cdot a\right) \cdot 4\right)} \cdot \sqrt[3]{\mathsf{fma}\left(j, k \cdot 27, \mathsf{fma}\left(x, i, t \cdot a\right) \cdot 4\right)}\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, c, t \cdot \left(\left(\left(18 \cdot x\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), \left(\left(k \cdot \sqrt{27}\right) \cdot j\right) \cdot \sqrt{27}\right)\right)\\

\end{array}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r528823 = x;
        double r528824 = 18.0;
        double r528825 = r528823 * r528824;
        double r528826 = y;
        double r528827 = r528825 * r528826;
        double r528828 = z;
        double r528829 = r528827 * r528828;
        double r528830 = t;
        double r528831 = r528829 * r528830;
        double r528832 = a;
        double r528833 = 4.0;
        double r528834 = r528832 * r528833;
        double r528835 = r528834 * r528830;
        double r528836 = r528831 - r528835;
        double r528837 = b;
        double r528838 = c;
        double r528839 = r528837 * r528838;
        double r528840 = r528836 + r528839;
        double r528841 = r528823 * r528833;
        double r528842 = i;
        double r528843 = r528841 * r528842;
        double r528844 = r528840 - r528843;
        double r528845 = j;
        double r528846 = 27.0;
        double r528847 = r528845 * r528846;
        double r528848 = k;
        double r528849 = r528847 * r528848;
        double r528850 = r528844 - r528849;
        return r528850;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r528851 = t;
        double r528852 = -7.497416902329218e-90;
        bool r528853 = r528851 <= r528852;
        double r528854 = b;
        double r528855 = c;
        double r528856 = 18.0;
        double r528857 = y;
        double r528858 = r528856 * r528857;
        double r528859 = x;
        double r528860 = r528858 * r528859;
        double r528861 = z;
        double r528862 = r528860 * r528861;
        double r528863 = r528862 * r528851;
        double r528864 = 4.0;
        double r528865 = a;
        double r528866 = i;
        double r528867 = r528866 * r528859;
        double r528868 = fma(r528851, r528865, r528867);
        double r528869 = 27.0;
        double r528870 = j;
        double r528871 = k;
        double r528872 = r528870 * r528871;
        double r528873 = r528869 * r528872;
        double r528874 = fma(r528864, r528868, r528873);
        double r528875 = r528863 - r528874;
        double r528876 = fma(r528854, r528855, r528875);
        double r528877 = 8.621654608286014e-206;
        bool r528878 = r528851 <= r528877;
        double r528879 = r528859 * r528851;
        double r528880 = r528879 * r528858;
        double r528881 = r528861 * r528880;
        double r528882 = r528871 * r528869;
        double r528883 = r528851 * r528865;
        double r528884 = fma(r528859, r528866, r528883);
        double r528885 = r528884 * r528864;
        double r528886 = fma(r528870, r528882, r528885);
        double r528887 = cbrt(r528886);
        double r528888 = r528887 * r528887;
        double r528889 = r528887 * r528888;
        double r528890 = r528881 - r528889;
        double r528891 = fma(r528854, r528855, r528890);
        double r528892 = r528856 * r528859;
        double r528893 = r528892 * r528857;
        double r528894 = r528893 * r528861;
        double r528895 = r528851 * r528894;
        double r528896 = sqrt(r528869);
        double r528897 = r528871 * r528896;
        double r528898 = r528897 * r528870;
        double r528899 = r528898 * r528896;
        double r528900 = fma(r528864, r528868, r528899);
        double r528901 = r528895 - r528900;
        double r528902 = fma(r528854, r528855, r528901);
        double r528903 = r528878 ? r528891 : r528902;
        double r528904 = r528853 ? r528876 : r528903;
        return r528904;
}

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

Bits error versus i

Bits error versus j

Bits error versus k

Target

Original5.9
Target1.6
Herbie3.1
\[\begin{array}{l} \mathbf{if}\;t \lt -1.62108153975413982700795070153457058168 \cdot 10^{-69}:\\ \;\;\;\;\left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - \left(a \cdot t + i \cdot x\right) \cdot 4\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\ \mathbf{elif}\;t \lt 165.6802794380522243500308832153677940369:\\ \;\;\;\;\left(\left(18 \cdot y\right) \cdot \left(x \cdot \left(z \cdot t\right)\right) - \left(a \cdot t + i \cdot x\right) \cdot 4\right) + \left(c \cdot b - 27 \cdot \left(k \cdot j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - \left(a \cdot t + i \cdot x\right) \cdot 4\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -7.497416902329218e-90

    1. Initial program 2.7

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k\]
    2. Simplified2.7

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \cdot j\right) \cdot k\right)\right)}\]
    3. Using strategy rm
    4. Applied associate-*l*2.6

      \[\leadsto \mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \color{blue}{27 \cdot \left(j \cdot k\right)}\right)\right)\]
    5. Using strategy rm
    6. Applied *-un-lft-identity2.6

      \[\leadsto \mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot \color{blue}{\left(1 \cdot z\right)}\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(j \cdot k\right)\right)\right)\]
    7. Applied associate-*r*2.6

      \[\leadsto \mathsf{fma}\left(b, c, t \cdot \color{blue}{\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot 1\right) \cdot z\right)} - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(j \cdot k\right)\right)\right)\]
    8. Simplified2.6

      \[\leadsto \mathsf{fma}\left(b, c, t \cdot \left(\color{blue}{\left(x \cdot \left(y \cdot 18\right)\right)} \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(j \cdot k\right)\right)\right)\]

    if -7.497416902329218e-90 < t < 8.621654608286014e-206

    1. Initial program 10.2

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k\]
    2. Simplified10.1

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \cdot j\right) \cdot k\right)\right)}\]
    3. Using strategy rm
    4. Applied associate-*l*10.0

      \[\leadsto \mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \color{blue}{27 \cdot \left(j \cdot k\right)}\right)\right)\]
    5. Using strategy rm
    6. Applied associate-*r*5.4

      \[\leadsto \mathsf{fma}\left(b, c, \color{blue}{\left(t \cdot \left(\left(x \cdot 18\right) \cdot y\right)\right) \cdot z} - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(j \cdot k\right)\right)\right)\]
    7. Simplified1.2

      \[\leadsto \mathsf{fma}\left(b, c, \color{blue}{\left(\left(x \cdot t\right) \cdot \left(y \cdot 18\right)\right)} \cdot z - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(j \cdot k\right)\right)\right)\]
    8. Using strategy rm
    9. Applied add-cube-cbrt1.9

      \[\leadsto \mathsf{fma}\left(b, c, \left(\left(x \cdot t\right) \cdot \left(y \cdot 18\right)\right) \cdot z - \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(j \cdot k\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(j \cdot k\right)\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(j \cdot k\right)\right)}}\right)\]
    10. Simplified2.0

      \[\leadsto \mathsf{fma}\left(b, c, \left(\left(x \cdot t\right) \cdot \left(y \cdot 18\right)\right) \cdot z - \color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(j, 27 \cdot k, 4 \cdot \mathsf{fma}\left(x, i, a \cdot t\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(j, 27 \cdot k, 4 \cdot \mathsf{fma}\left(x, i, a \cdot t\right)\right)}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(j \cdot k\right)\right)}\right)\]
    11. Simplified2.0

      \[\leadsto \mathsf{fma}\left(b, c, \left(\left(x \cdot t\right) \cdot \left(y \cdot 18\right)\right) \cdot z - \left(\sqrt[3]{\mathsf{fma}\left(j, 27 \cdot k, 4 \cdot \mathsf{fma}\left(x, i, a \cdot t\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(j, 27 \cdot k, 4 \cdot \mathsf{fma}\left(x, i, a \cdot t\right)\right)}\right) \cdot \color{blue}{\sqrt[3]{\mathsf{fma}\left(j, 27 \cdot k, 4 \cdot \mathsf{fma}\left(x, i, a \cdot t\right)\right)}}\right)\]

    if 8.621654608286014e-206 < t

    1. Initial program 4.5

      \[\left(\left(\left(\left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4\right) \cdot i\right) - \left(j \cdot 27\right) \cdot k\]
    2. Simplified4.4

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \cdot j\right) \cdot k\right)\right)}\]
    3. Using strategy rm
    4. Applied associate-*l*4.3

      \[\leadsto \mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \color{blue}{27 \cdot \left(j \cdot k\right)}\right)\right)\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt4.3

      \[\leadsto \mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \color{blue}{\left(\sqrt{27} \cdot \sqrt{27}\right)} \cdot \left(j \cdot k\right)\right)\right)\]
    7. Applied associate-*l*4.4

      \[\leadsto \mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \color{blue}{\sqrt{27} \cdot \left(\sqrt{27} \cdot \left(j \cdot k\right)\right)}\right)\right)\]
    8. Simplified4.4

      \[\leadsto \mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \sqrt{27} \cdot \color{blue}{\left(j \cdot \left(k \cdot \sqrt{27}\right)\right)}\right)\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -7.497416902329217719773679954021670957821 \cdot 10^{-90}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(\left(\left(18 \cdot y\right) \cdot x\right) \cdot z\right) \cdot t - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), 27 \cdot \left(j \cdot k\right)\right)\right)\\ \mathbf{elif}\;t \le 8.621654608286013508351055408676881547749 \cdot 10^{-206}:\\ \;\;\;\;\mathsf{fma}\left(b, c, z \cdot \left(\left(x \cdot t\right) \cdot \left(18 \cdot y\right)\right) - \sqrt[3]{\mathsf{fma}\left(j, k \cdot 27, \mathsf{fma}\left(x, i, t \cdot a\right) \cdot 4\right)} \cdot \left(\sqrt[3]{\mathsf{fma}\left(j, k \cdot 27, \mathsf{fma}\left(x, i, t \cdot a\right) \cdot 4\right)} \cdot \sqrt[3]{\mathsf{fma}\left(j, k \cdot 27, \mathsf{fma}\left(x, i, t \cdot a\right) \cdot 4\right)}\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, t \cdot \left(\left(\left(18 \cdot x\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), \left(\left(k \cdot \sqrt{27}\right) \cdot j\right) \cdot \sqrt{27}\right)\right)\\ \end{array}\]

Reproduce

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

  :herbie-target
  (if (< t -1.6210815397541398e-69) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b))) (if (< t 165.68027943805222) (+ (- (* (* 18.0 y) (* x (* z t))) (* (+ (* a t) (* i x)) 4.0)) (- (* c b) (* 27.0 (* k j)))) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b)))))

  (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))