Average Error: 5.2 → 4.6
Time: 13.0s
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 -1.83021247636856358 \cdot 10^{-208}:\\ \;\;\;\;\mathsf{fma}\left(t, \left(\sqrt[3]{\left(\left(x \cdot 18\right) \cdot y\right) \cdot z} \cdot \sqrt[3]{\left(\left(x \cdot 18\right) \cdot y\right) \cdot z}\right) \cdot \sqrt[3]{\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)\\ \mathbf{elif}\;t \le 7.732515616110861 \cdot 10^{-74}:\\ \;\;\;\;\mathsf{fma}\left(t, 0 - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\right) \cdot k\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, \left(x \cdot 18\right) \cdot \left(y \cdot z\right) - 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 -1.83021247636856358 \cdot 10^{-208}:\\
\;\;\;\;\mathsf{fma}\left(t, \left(\sqrt[3]{\left(\left(x \cdot 18\right) \cdot y\right) \cdot z} \cdot \sqrt[3]{\left(\left(x \cdot 18\right) \cdot y\right) \cdot z}\right) \cdot \sqrt[3]{\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)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \left(x \cdot 18\right) \cdot \left(y \cdot z\right) - 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 r172396 = x;
        double r172397 = 18.0;
        double r172398 = r172396 * r172397;
        double r172399 = y;
        double r172400 = r172398 * r172399;
        double r172401 = z;
        double r172402 = r172400 * r172401;
        double r172403 = t;
        double r172404 = r172402 * r172403;
        double r172405 = a;
        double r172406 = 4.0;
        double r172407 = r172405 * r172406;
        double r172408 = r172407 * r172403;
        double r172409 = r172404 - r172408;
        double r172410 = b;
        double r172411 = c;
        double r172412 = r172410 * r172411;
        double r172413 = r172409 + r172412;
        double r172414 = r172396 * r172406;
        double r172415 = i;
        double r172416 = r172414 * r172415;
        double r172417 = r172413 - r172416;
        double r172418 = j;
        double r172419 = 27.0;
        double r172420 = r172418 * r172419;
        double r172421 = k;
        double r172422 = r172420 * r172421;
        double r172423 = r172417 - r172422;
        return r172423;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r172424 = t;
        double r172425 = -1.8302124763685636e-208;
        bool r172426 = r172424 <= r172425;
        double r172427 = x;
        double r172428 = 18.0;
        double r172429 = r172427 * r172428;
        double r172430 = y;
        double r172431 = r172429 * r172430;
        double r172432 = z;
        double r172433 = r172431 * r172432;
        double r172434 = cbrt(r172433);
        double r172435 = r172434 * r172434;
        double r172436 = r172435 * r172434;
        double r172437 = a;
        double r172438 = 4.0;
        double r172439 = r172437 * r172438;
        double r172440 = r172436 - r172439;
        double r172441 = b;
        double r172442 = c;
        double r172443 = r172441 * r172442;
        double r172444 = i;
        double r172445 = r172438 * r172444;
        double r172446 = j;
        double r172447 = 27.0;
        double r172448 = k;
        double r172449 = r172447 * r172448;
        double r172450 = r172446 * r172449;
        double r172451 = fma(r172427, r172445, r172450);
        double r172452 = r172443 - r172451;
        double r172453 = fma(r172424, r172440, r172452);
        double r172454 = 7.732515616110861e-74;
        bool r172455 = r172424 <= r172454;
        double r172456 = 0.0;
        double r172457 = r172456 - r172439;
        double r172458 = r172446 * r172447;
        double r172459 = r172458 * r172448;
        double r172460 = fma(r172427, r172445, r172459);
        double r172461 = r172443 - r172460;
        double r172462 = fma(r172424, r172457, r172461);
        double r172463 = r172430 * r172432;
        double r172464 = r172429 * r172463;
        double r172465 = r172464 - r172439;
        double r172466 = fma(r172424, r172465, r172452);
        double r172467 = r172455 ? r172462 : r172466;
        double r172468 = r172426 ? r172453 : r172467;
        return r172468;
}

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 < -1.8302124763685636e-208

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

      \[\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*4.2

      \[\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. Using strategy rm
    6. Applied add-cube-cbrt4.4

      \[\leadsto \mathsf{fma}\left(t, \color{blue}{\left(\sqrt[3]{\left(\left(x \cdot 18\right) \cdot y\right) \cdot z} \cdot \sqrt[3]{\left(\left(x \cdot 18\right) \cdot y\right) \cdot z}\right) \cdot \sqrt[3]{\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)\]

    if -1.8302124763685636e-208 < t < 7.732515616110861e-74

    1. Initial program 8.4

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

      \[\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. Taylor expanded around 0 5.8

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

    if 7.732515616110861e-74 < t

    1. Initial program 2.4

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

      \[\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*2.5

      \[\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. Using strategy rm
    6. Applied associate-*l*3.6

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -1.83021247636856358 \cdot 10^{-208}:\\ \;\;\;\;\mathsf{fma}\left(t, \left(\sqrt[3]{\left(\left(x \cdot 18\right) \cdot y\right) \cdot z} \cdot \sqrt[3]{\left(\left(x \cdot 18\right) \cdot y\right) \cdot z}\right) \cdot \sqrt[3]{\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)\\ \mathbf{elif}\;t \le 7.732515616110861 \cdot 10^{-74}:\\ \;\;\;\;\mathsf{fma}\left(t, 0 - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\right) \cdot k\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(t, \left(x \cdot 18\right) \cdot \left(y \cdot z\right) - 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 2020047 +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)))