Average Error: 5.9 → 1.8
Time: 30.2s
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}\;z \le -4.872473314684069170084131104847792702954 \cdot 10^{103}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(t \cdot \left(y \cdot \left(18 \cdot x\right)\right)\right) \cdot z - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), 27 \cdot \left(j \cdot k\right)\right)\right)\\ \mathbf{elif}\;z \le 5233734057954217984:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(t \cdot \left(\left(y \cdot z\right) \cdot x\right)\right) \cdot 18 - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), 27 \cdot \left(j \cdot k\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(t \cdot \left(y \cdot \left(18 \cdot x\right)\right)\right) \cdot z - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), 27 \cdot \left(j \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}\;z \le -4.872473314684069170084131104847792702954 \cdot 10^{103}:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(t \cdot \left(y \cdot \left(18 \cdot x\right)\right)\right) \cdot z - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), 27 \cdot \left(j \cdot k\right)\right)\right)\\

\mathbf{elif}\;z \le 5233734057954217984:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(t \cdot \left(\left(y \cdot z\right) \cdot x\right)\right) \cdot 18 - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), 27 \cdot \left(j \cdot k\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(t \cdot \left(y \cdot \left(18 \cdot x\right)\right)\right) \cdot z - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), 27 \cdot \left(j \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 r5398570 = x;
        double r5398571 = 18.0;
        double r5398572 = r5398570 * r5398571;
        double r5398573 = y;
        double r5398574 = r5398572 * r5398573;
        double r5398575 = z;
        double r5398576 = r5398574 * r5398575;
        double r5398577 = t;
        double r5398578 = r5398576 * r5398577;
        double r5398579 = a;
        double r5398580 = 4.0;
        double r5398581 = r5398579 * r5398580;
        double r5398582 = r5398581 * r5398577;
        double r5398583 = r5398578 - r5398582;
        double r5398584 = b;
        double r5398585 = c;
        double r5398586 = r5398584 * r5398585;
        double r5398587 = r5398583 + r5398586;
        double r5398588 = r5398570 * r5398580;
        double r5398589 = i;
        double r5398590 = r5398588 * r5398589;
        double r5398591 = r5398587 - r5398590;
        double r5398592 = j;
        double r5398593 = 27.0;
        double r5398594 = r5398592 * r5398593;
        double r5398595 = k;
        double r5398596 = r5398594 * r5398595;
        double r5398597 = r5398591 - r5398596;
        return r5398597;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r5398598 = z;
        double r5398599 = -4.872473314684069e+103;
        bool r5398600 = r5398598 <= r5398599;
        double r5398601 = b;
        double r5398602 = c;
        double r5398603 = t;
        double r5398604 = y;
        double r5398605 = 18.0;
        double r5398606 = x;
        double r5398607 = r5398605 * r5398606;
        double r5398608 = r5398604 * r5398607;
        double r5398609 = r5398603 * r5398608;
        double r5398610 = r5398609 * r5398598;
        double r5398611 = 4.0;
        double r5398612 = a;
        double r5398613 = i;
        double r5398614 = r5398613 * r5398606;
        double r5398615 = fma(r5398603, r5398612, r5398614);
        double r5398616 = 27.0;
        double r5398617 = j;
        double r5398618 = k;
        double r5398619 = r5398617 * r5398618;
        double r5398620 = r5398616 * r5398619;
        double r5398621 = fma(r5398611, r5398615, r5398620);
        double r5398622 = r5398610 - r5398621;
        double r5398623 = fma(r5398601, r5398602, r5398622);
        double r5398624 = 5.233734057954218e+18;
        bool r5398625 = r5398598 <= r5398624;
        double r5398626 = r5398604 * r5398598;
        double r5398627 = r5398626 * r5398606;
        double r5398628 = r5398603 * r5398627;
        double r5398629 = r5398628 * r5398605;
        double r5398630 = r5398629 - r5398621;
        double r5398631 = fma(r5398601, r5398602, r5398630);
        double r5398632 = r5398625 ? r5398631 : r5398623;
        double r5398633 = r5398600 ? r5398623 : r5398632;
        return r5398633;
}

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 < -4.872473314684069e+103 or 5.233734057954218e+18 < z

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(b, c, t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \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(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \color{blue}{27 \cdot \left(j \cdot k\right)}\right)\right)\]
    5. Using strategy rm
    6. Applied associate-*r*1.7

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

    if -4.872473314684069e+103 < z < 5.233734057954218e+18

    1. Initial program 4.7

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

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

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

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

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

Reproduce

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