Average Error: 5.4 → 4.0
Time: 38.1s
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}\;x \le -7.654247913107458 \cdot 10^{+153}:\\ \;\;\;\;\mathsf{fma}\left(18.0 \cdot \left(x \cdot \left(z \cdot y\right)\right), t, b \cdot c - \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}:\\ \;\;\;\;\left(b \cdot c - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(k \cdot j\right) \cdot 27.0\right)\right) + y \cdot \left(\left(18.0 \cdot \left(z \cdot x\right)\right) \cdot t\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}\;x \le -7.654247913107458 \cdot 10^{+153}:\\
\;\;\;\;\mathsf{fma}\left(18.0 \cdot \left(x \cdot \left(z \cdot y\right)\right), t, b \cdot c - \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}:\\
\;\;\;\;\left(b \cdot c - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(k \cdot j\right) \cdot 27.0\right)\right) + y \cdot \left(\left(18.0 \cdot \left(z \cdot x\right)\right) \cdot t\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 r4658089 = x;
        double r4658090 = 18.0;
        double r4658091 = r4658089 * r4658090;
        double r4658092 = y;
        double r4658093 = r4658091 * r4658092;
        double r4658094 = z;
        double r4658095 = r4658093 * r4658094;
        double r4658096 = t;
        double r4658097 = r4658095 * r4658096;
        double r4658098 = a;
        double r4658099 = 4.0;
        double r4658100 = r4658098 * r4658099;
        double r4658101 = r4658100 * r4658096;
        double r4658102 = r4658097 - r4658101;
        double r4658103 = b;
        double r4658104 = c;
        double r4658105 = r4658103 * r4658104;
        double r4658106 = r4658102 + r4658105;
        double r4658107 = r4658089 * r4658099;
        double r4658108 = i;
        double r4658109 = r4658107 * r4658108;
        double r4658110 = r4658106 - r4658109;
        double r4658111 = j;
        double r4658112 = 27.0;
        double r4658113 = r4658111 * r4658112;
        double r4658114 = k;
        double r4658115 = r4658113 * r4658114;
        double r4658116 = r4658110 - r4658115;
        return r4658116;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r4658117 = x;
        double r4658118 = -7.654247913107458e+153;
        bool r4658119 = r4658117 <= r4658118;
        double r4658120 = 18.0;
        double r4658121 = z;
        double r4658122 = y;
        double r4658123 = r4658121 * r4658122;
        double r4658124 = r4658117 * r4658123;
        double r4658125 = r4658120 * r4658124;
        double r4658126 = t;
        double r4658127 = b;
        double r4658128 = c;
        double r4658129 = r4658127 * r4658128;
        double r4658130 = 4.0;
        double r4658131 = a;
        double r4658132 = i;
        double r4658133 = r4658132 * r4658117;
        double r4658134 = fma(r4658126, r4658131, r4658133);
        double r4658135 = 27.0;
        double r4658136 = j;
        double r4658137 = r4658135 * r4658136;
        double r4658138 = k;
        double r4658139 = r4658137 * r4658138;
        double r4658140 = fma(r4658130, r4658134, r4658139);
        double r4658141 = r4658129 - r4658140;
        double r4658142 = fma(r4658125, r4658126, r4658141);
        double r4658143 = r4658138 * r4658136;
        double r4658144 = r4658143 * r4658135;
        double r4658145 = fma(r4658130, r4658134, r4658144);
        double r4658146 = r4658129 - r4658145;
        double r4658147 = r4658121 * r4658117;
        double r4658148 = r4658120 * r4658147;
        double r4658149 = r4658148 * r4658126;
        double r4658150 = r4658122 * r4658149;
        double r4658151 = r4658146 + r4658150;
        double r4658152 = r4658119 ? r4658142 : r4658151;
        return r4658152;
}

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 x < -7.654247913107458e+153

    1. Initial program 17.2

      \[\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. Simplified17.5

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

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

    if -7.654247913107458e+153 < x

    1. Initial program 4.6

      \[\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. Simplified4.4

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -7.654247913107458 \cdot 10^{+153}:\\ \;\;\;\;\mathsf{fma}\left(18.0 \cdot \left(x \cdot \left(z \cdot y\right)\right), t, b \cdot c - \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}:\\ \;\;\;\;\left(b \cdot c - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), \left(k \cdot j\right) \cdot 27.0\right)\right) + y \cdot \left(\left(18.0 \cdot \left(z \cdot x\right)\right) \cdot t\right)\\ \end{array}\]

Reproduce

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