Average Error: 5.2 → 2.0
Time: 29.6s
Precision: 64
\[\left(\left(\left(\left(\left(\left(x \cdot 18.0\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4.0\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4.0\right) \cdot i\right) - \left(j \cdot 27.0\right) \cdot k\]
\[\begin{array}{l} \mathbf{if}\;t \le -9.364786979599531 \cdot 10^{-95}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(18.0 \cdot \left(\left(z \cdot y\right) \cdot x\right)\right) \cdot t - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\\ \mathbf{elif}\;t \le 1.552559671841611 \cdot 10^{-43}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(x \cdot \left(\left(18.0 \cdot t\right) \cdot y\right)\right) \cdot z - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(18.0 \cdot \left(\left(z \cdot y\right) \cdot x\right)\right) \cdot t - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\\ \end{array}\]
\left(\left(\left(\left(\left(\left(x \cdot 18.0\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4.0\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4.0\right) \cdot i\right) - \left(j \cdot 27.0\right) \cdot k
\begin{array}{l}
\mathbf{if}\;t \le -9.364786979599531 \cdot 10^{-95}:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(18.0 \cdot \left(\left(z \cdot y\right) \cdot x\right)\right) \cdot t - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\\

\mathbf{elif}\;t \le 1.552559671841611 \cdot 10^{-43}:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(x \cdot \left(\left(18.0 \cdot t\right) \cdot y\right)\right) \cdot z - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(18.0 \cdot \left(\left(z \cdot y\right) \cdot x\right)\right) \cdot t - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(27.0 \cdot j\right) \cdot k\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 r4408920 = x;
        double r4408921 = 18.0;
        double r4408922 = r4408920 * r4408921;
        double r4408923 = y;
        double r4408924 = r4408922 * r4408923;
        double r4408925 = z;
        double r4408926 = r4408924 * r4408925;
        double r4408927 = t;
        double r4408928 = r4408926 * r4408927;
        double r4408929 = a;
        double r4408930 = 4.0;
        double r4408931 = r4408929 * r4408930;
        double r4408932 = r4408931 * r4408927;
        double r4408933 = r4408928 - r4408932;
        double r4408934 = b;
        double r4408935 = c;
        double r4408936 = r4408934 * r4408935;
        double r4408937 = r4408933 + r4408936;
        double r4408938 = r4408920 * r4408930;
        double r4408939 = i;
        double r4408940 = r4408938 * r4408939;
        double r4408941 = r4408937 - r4408940;
        double r4408942 = j;
        double r4408943 = 27.0;
        double r4408944 = r4408942 * r4408943;
        double r4408945 = k;
        double r4408946 = r4408944 * r4408945;
        double r4408947 = r4408941 - r4408946;
        return r4408947;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r4408948 = t;
        double r4408949 = -9.364786979599531e-95;
        bool r4408950 = r4408948 <= r4408949;
        double r4408951 = b;
        double r4408952 = c;
        double r4408953 = 18.0;
        double r4408954 = z;
        double r4408955 = y;
        double r4408956 = r4408954 * r4408955;
        double r4408957 = x;
        double r4408958 = r4408956 * r4408957;
        double r4408959 = r4408953 * r4408958;
        double r4408960 = r4408959 * r4408948;
        double r4408961 = 4.0;
        double r4408962 = a;
        double r4408963 = i;
        double r4408964 = r4408963 * r4408957;
        double r4408965 = fma(r4408948, r4408962, r4408964);
        double r4408966 = 27.0;
        double r4408967 = j;
        double r4408968 = r4408966 * r4408967;
        double r4408969 = k;
        double r4408970 = r4408968 * r4408969;
        double r4408971 = fma(r4408961, r4408965, r4408970);
        double r4408972 = r4408960 - r4408971;
        double r4408973 = fma(r4408951, r4408952, r4408972);
        double r4408974 = 1.552559671841611e-43;
        bool r4408975 = r4408948 <= r4408974;
        double r4408976 = r4408953 * r4408948;
        double r4408977 = r4408976 * r4408955;
        double r4408978 = r4408957 * r4408977;
        double r4408979 = r4408978 * r4408954;
        double r4408980 = r4408979 - r4408971;
        double r4408981 = fma(r4408951, r4408952, r4408980);
        double r4408982 = r4408975 ? r4408981 : r4408973;
        double r4408983 = r4408950 ? r4408973 : r4408982;
        return r4408983;
}

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

Derivation

  1. Split input into 2 regimes
  2. if t < -9.364786979599531e-95 or 1.552559671841611e-43 < t

    1. Initial program 2.4

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18.0\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27.0 \cdot j\right) \cdot k\right)\right)}\]
    3. Taylor expanded around inf 3.0

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

    if -9.364786979599531e-95 < t < 1.552559671841611e-43

    1. Initial program 8.0

      \[\left(\left(\left(\left(\left(\left(x \cdot 18.0\right) \cdot y\right) \cdot z\right) \cdot t - \left(a \cdot 4.0\right) \cdot t\right) + b \cdot c\right) - \left(x \cdot 4.0\right) \cdot i\right) - \left(j \cdot 27.0\right) \cdot k\]
    2. Simplified7.9

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

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

      \[\leadsto \mathsf{fma}\left(b, c, \color{blue}{\left(t \cdot \left(x \cdot \left(18.0 \cdot y\right)\right)\right) \cdot z} - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\]
    7. Using strategy rm
    8. Applied *-un-lft-identity4.2

      \[\leadsto \mathsf{fma}\left(b, c, \left(t \cdot \left(x \cdot \left(18.0 \cdot y\right)\right)\right) \cdot \color{blue}{\left(1 \cdot z\right)} - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\]
    9. Applied associate-*r*4.2

      \[\leadsto \mathsf{fma}\left(b, c, \color{blue}{\left(\left(t \cdot \left(x \cdot \left(18.0 \cdot y\right)\right)\right) \cdot 1\right) \cdot z} - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\]
    10. Simplified1.0

      \[\leadsto \mathsf{fma}\left(b, c, \color{blue}{\left(\left(\left(t \cdot 18.0\right) \cdot y\right) \cdot x\right)} \cdot z - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -9.364786979599531 \cdot 10^{-95}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(18.0 \cdot \left(\left(z \cdot y\right) \cdot x\right)\right) \cdot t - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\\ \mathbf{elif}\;t \le 1.552559671841611 \cdot 10^{-43}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(x \cdot \left(\left(18.0 \cdot t\right) \cdot y\right)\right) \cdot z - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(18.0 \cdot \left(\left(z \cdot y\right) \cdot x\right)\right) \cdot t - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(27.0 \cdot j\right) \cdot k\right)\right)\\ \end{array}\]

Reproduce

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