Average Error: 4.9 → 1.8
Time: 31.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}\;z \le -6.338863715081203 \cdot 10^{-20}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(\left(\left(t \cdot x\right) \cdot y\right) \cdot 18.0\right) \cdot z - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), 27.0 \cdot \left(k \cdot j\right)\right)\right)\\ \mathbf{elif}\;z \le 8.320283028555687 \cdot 10^{+114}:\\ \;\;\;\;\mathsf{fma}\left(b, c, 18.0 \cdot \left(t \cdot \left(\left(z \cdot y\right) \cdot x\right)\right) - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), j \cdot \left(27.0 \cdot k\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(\left(\left(t \cdot x\right) \cdot y\right) \cdot 18.0\right) \cdot z - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), 27.0 \cdot \left(k \cdot j\right)\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}\;z \le -6.338863715081203 \cdot 10^{-20}:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(\left(\left(t \cdot x\right) \cdot y\right) \cdot 18.0\right) \cdot z - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), 27.0 \cdot \left(k \cdot j\right)\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(\left(\left(t \cdot x\right) \cdot y\right) \cdot 18.0\right) \cdot z - \mathsf{fma}\left(4.0, \mathsf{fma}\left(t, a, i \cdot x\right), 27.0 \cdot \left(k \cdot j\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 r4524696 = x;
        double r4524697 = 18.0;
        double r4524698 = r4524696 * r4524697;
        double r4524699 = y;
        double r4524700 = r4524698 * r4524699;
        double r4524701 = z;
        double r4524702 = r4524700 * r4524701;
        double r4524703 = t;
        double r4524704 = r4524702 * r4524703;
        double r4524705 = a;
        double r4524706 = 4.0;
        double r4524707 = r4524705 * r4524706;
        double r4524708 = r4524707 * r4524703;
        double r4524709 = r4524704 - r4524708;
        double r4524710 = b;
        double r4524711 = c;
        double r4524712 = r4524710 * r4524711;
        double r4524713 = r4524709 + r4524712;
        double r4524714 = r4524696 * r4524706;
        double r4524715 = i;
        double r4524716 = r4524714 * r4524715;
        double r4524717 = r4524713 - r4524716;
        double r4524718 = j;
        double r4524719 = 27.0;
        double r4524720 = r4524718 * r4524719;
        double r4524721 = k;
        double r4524722 = r4524720 * r4524721;
        double r4524723 = r4524717 - r4524722;
        return r4524723;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r4524724 = z;
        double r4524725 = -6.338863715081203e-20;
        bool r4524726 = r4524724 <= r4524725;
        double r4524727 = b;
        double r4524728 = c;
        double r4524729 = t;
        double r4524730 = x;
        double r4524731 = r4524729 * r4524730;
        double r4524732 = y;
        double r4524733 = r4524731 * r4524732;
        double r4524734 = 18.0;
        double r4524735 = r4524733 * r4524734;
        double r4524736 = r4524735 * r4524724;
        double r4524737 = 4.0;
        double r4524738 = a;
        double r4524739 = i;
        double r4524740 = r4524739 * r4524730;
        double r4524741 = fma(r4524729, r4524738, r4524740);
        double r4524742 = 27.0;
        double r4524743 = k;
        double r4524744 = j;
        double r4524745 = r4524743 * r4524744;
        double r4524746 = r4524742 * r4524745;
        double r4524747 = fma(r4524737, r4524741, r4524746);
        double r4524748 = r4524736 - r4524747;
        double r4524749 = fma(r4524727, r4524728, r4524748);
        double r4524750 = 8.320283028555687e+114;
        bool r4524751 = r4524724 <= r4524750;
        double r4524752 = r4524724 * r4524732;
        double r4524753 = r4524752 * r4524730;
        double r4524754 = r4524729 * r4524753;
        double r4524755 = r4524734 * r4524754;
        double r4524756 = r4524742 * r4524743;
        double r4524757 = r4524744 * r4524756;
        double r4524758 = fma(r4524737, r4524741, r4524757);
        double r4524759 = r4524755 - r4524758;
        double r4524760 = fma(r4524727, r4524728, r4524759);
        double r4524761 = r4524751 ? r4524760 : r4524749;
        double r4524762 = r4524726 ? r4524749 : r4524761;
        return r4524762;
}

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 z < -6.338863715081203e-20 or 8.320283028555687e+114 < z

    1. Initial program 6.5

      \[\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.2

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

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

    if -6.338863715081203e-20 < z < 8.320283028555687e+114

    1. Initial program 4.1

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

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

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

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

      \[\leadsto \mathsf{fma}\left(b, c, \color{blue}{18.0 \cdot \left(t \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 k\right) \cdot j\right)\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.8

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

Reproduce

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