Average Error: 5.4 → 2.0
Time: 1.2m
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}\;x \le -1.09062840131856804 \cdot 10^{48} \lor \neg \left(x \le 1.08808733666263652 \cdot 10^{39}\right):\\ \;\;\;\;\mathsf{fma}\left(c, b, x \cdot \left(\left(18 \cdot y\right) \cdot \left(t \cdot z\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(j \cdot 27\right) \cdot k\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), j \cdot \left(27 \cdot k\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}\;x \le -1.09062840131856804 \cdot 10^{48} \lor \neg \left(x \le 1.08808733666263652 \cdot 10^{39}\right):\\
\;\;\;\;\mathsf{fma}\left(c, b, x \cdot \left(\left(18 \cdot y\right) \cdot \left(t \cdot z\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(j \cdot 27\right) \cdot k\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), j \cdot \left(27 \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 r101992 = x;
        double r101993 = 18.0;
        double r101994 = r101992 * r101993;
        double r101995 = y;
        double r101996 = r101994 * r101995;
        double r101997 = z;
        double r101998 = r101996 * r101997;
        double r101999 = t;
        double r102000 = r101998 * r101999;
        double r102001 = a;
        double r102002 = 4.0;
        double r102003 = r102001 * r102002;
        double r102004 = r102003 * r101999;
        double r102005 = r102000 - r102004;
        double r102006 = b;
        double r102007 = c;
        double r102008 = r102006 * r102007;
        double r102009 = r102005 + r102008;
        double r102010 = r101992 * r102002;
        double r102011 = i;
        double r102012 = r102010 * r102011;
        double r102013 = r102009 - r102012;
        double r102014 = j;
        double r102015 = 27.0;
        double r102016 = r102014 * r102015;
        double r102017 = k;
        double r102018 = r102016 * r102017;
        double r102019 = r102013 - r102018;
        return r102019;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r102020 = x;
        double r102021 = -1.090628401318568e+48;
        bool r102022 = r102020 <= r102021;
        double r102023 = 1.0880873366626365e+39;
        bool r102024 = r102020 <= r102023;
        double r102025 = !r102024;
        bool r102026 = r102022 || r102025;
        double r102027 = c;
        double r102028 = b;
        double r102029 = 18.0;
        double r102030 = y;
        double r102031 = r102029 * r102030;
        double r102032 = t;
        double r102033 = z;
        double r102034 = r102032 * r102033;
        double r102035 = r102031 * r102034;
        double r102036 = r102020 * r102035;
        double r102037 = fma(r102027, r102028, r102036);
        double r102038 = 4.0;
        double r102039 = a;
        double r102040 = i;
        double r102041 = r102020 * r102040;
        double r102042 = fma(r102032, r102039, r102041);
        double r102043 = j;
        double r102044 = 27.0;
        double r102045 = r102043 * r102044;
        double r102046 = k;
        double r102047 = r102045 * r102046;
        double r102048 = fma(r102038, r102042, r102047);
        double r102049 = r102037 - r102048;
        double r102050 = r102020 * r102029;
        double r102051 = r102050 * r102030;
        double r102052 = r102051 * r102033;
        double r102053 = r102052 * r102032;
        double r102054 = fma(r102027, r102028, r102053);
        double r102055 = r102044 * r102046;
        double r102056 = r102043 * r102055;
        double r102057 = fma(r102038, r102042, r102056);
        double r102058 = r102054 - r102057;
        double r102059 = r102026 ? r102049 : r102058;
        return r102059;
}

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 < -1.090628401318568e+48 or 1.0880873366626365e+39 < x

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

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

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

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

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

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

    if -1.090628401318568e+48 < x < 1.0880873366626365e+39

    1. Initial program 2.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. Simplified2.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.09062840131856804 \cdot 10^{48} \lor \neg \left(x \le 1.08808733666263652 \cdot 10^{39}\right):\\ \;\;\;\;\mathsf{fma}\left(c, b, x \cdot \left(\left(18 \cdot y\right) \cdot \left(t \cdot z\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(j \cdot 27\right) \cdot k\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), j \cdot \left(27 \cdot k\right)\right)\\ \end{array}\]

Reproduce

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