Average Error: 5.7 → 4.7
Time: 18.8s
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 -2.5613291814136577 \cdot 10^{-127}:\\ \;\;\;\;\mathsf{fma}\left(t, x \cdot \left(\left(18 \cdot y\right) \cdot z\right) - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\right) \cdot k\right)\right)\\ \mathbf{elif}\;t \le 2.4037056843120258 \cdot 10^{-98}:\\ \;\;\;\;\mathsf{fma}\left(t, 0 - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, j \cdot \left(27 \cdot k\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, \left(\left(x \cdot 18\right) \cdot y\right) \cdot z - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, j \cdot \left(27 \cdot k\right)\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 -2.5613291814136577 \cdot 10^{-127}:\\
\;\;\;\;\mathsf{fma}\left(t, x \cdot \left(\left(18 \cdot y\right) \cdot z\right) - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\right) \cdot k\right)\right)\\

\mathbf{elif}\;t \le 2.4037056843120258 \cdot 10^{-98}:\\
\;\;\;\;\mathsf{fma}\left(t, 0 - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, j \cdot \left(27 \cdot k\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \left(\left(x \cdot 18\right) \cdot y\right) \cdot z - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, j \cdot \left(27 \cdot k\right)\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 r101591 = x;
        double r101592 = 18.0;
        double r101593 = r101591 * r101592;
        double r101594 = y;
        double r101595 = r101593 * r101594;
        double r101596 = z;
        double r101597 = r101595 * r101596;
        double r101598 = t;
        double r101599 = r101597 * r101598;
        double r101600 = a;
        double r101601 = 4.0;
        double r101602 = r101600 * r101601;
        double r101603 = r101602 * r101598;
        double r101604 = r101599 - r101603;
        double r101605 = b;
        double r101606 = c;
        double r101607 = r101605 * r101606;
        double r101608 = r101604 + r101607;
        double r101609 = r101591 * r101601;
        double r101610 = i;
        double r101611 = r101609 * r101610;
        double r101612 = r101608 - r101611;
        double r101613 = j;
        double r101614 = 27.0;
        double r101615 = r101613 * r101614;
        double r101616 = k;
        double r101617 = r101615 * r101616;
        double r101618 = r101612 - r101617;
        return r101618;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r101619 = t;
        double r101620 = -2.5613291814136577e-127;
        bool r101621 = r101619 <= r101620;
        double r101622 = x;
        double r101623 = 18.0;
        double r101624 = y;
        double r101625 = r101623 * r101624;
        double r101626 = z;
        double r101627 = r101625 * r101626;
        double r101628 = r101622 * r101627;
        double r101629 = a;
        double r101630 = 4.0;
        double r101631 = r101629 * r101630;
        double r101632 = r101628 - r101631;
        double r101633 = b;
        double r101634 = c;
        double r101635 = r101633 * r101634;
        double r101636 = i;
        double r101637 = r101630 * r101636;
        double r101638 = j;
        double r101639 = 27.0;
        double r101640 = r101638 * r101639;
        double r101641 = k;
        double r101642 = r101640 * r101641;
        double r101643 = fma(r101622, r101637, r101642);
        double r101644 = r101635 - r101643;
        double r101645 = fma(r101619, r101632, r101644);
        double r101646 = 2.4037056843120258e-98;
        bool r101647 = r101619 <= r101646;
        double r101648 = 0.0;
        double r101649 = r101648 - r101631;
        double r101650 = r101639 * r101641;
        double r101651 = r101638 * r101650;
        double r101652 = fma(r101622, r101637, r101651);
        double r101653 = r101635 - r101652;
        double r101654 = fma(r101619, r101649, r101653);
        double r101655 = r101622 * r101623;
        double r101656 = r101655 * r101624;
        double r101657 = r101656 * r101626;
        double r101658 = r101657 - r101631;
        double r101659 = fma(r101619, r101658, r101653);
        double r101660 = r101647 ? r101654 : r101659;
        double r101661 = r101621 ? r101645 : r101660;
        return r101661;
}

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 3 regimes
  2. if t < -2.5613291814136577e-127

    1. Initial program 3.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. Simplified3.3

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

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

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

    if -2.5613291814136577e-127 < t < 2.4037056843120258e-98

    1. Initial program 9.3

      \[\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. Simplified9.3

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

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

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

    if 2.4037056843120258e-98 < t

    1. Initial program 3.0

      \[\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. Simplified3.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -2.5613291814136577 \cdot 10^{-127}:\\ \;\;\;\;\mathsf{fma}\left(t, x \cdot \left(\left(18 \cdot y\right) \cdot z\right) - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\right) \cdot k\right)\right)\\ \mathbf{elif}\;t \le 2.4037056843120258 \cdot 10^{-98}:\\ \;\;\;\;\mathsf{fma}\left(t, 0 - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, j \cdot \left(27 \cdot k\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, \left(\left(x \cdot 18\right) \cdot y\right) \cdot z - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, j \cdot \left(27 \cdot k\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020064 +o rules:numerics
(FPCore (x y z t a b c i j k)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1"
  :precision binary64
  (- (- (+ (- (* (* (* (* x 18) y) z) t) (* (* a 4) t)) (* b c)) (* (* x 4) i)) (* (* j 27) k)))