Average Error: 5.7 → 4.3
Time: 33.9s
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}\;t \le -9.815254673950543 \cdot 10^{-140}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(x \cdot 18.0\right) \cdot z\right) \cdot y - a \cdot 4.0, t, b \cdot c - \mathsf{fma}\left(4.0 \cdot i, x, \left(\sqrt{27.0} \cdot \left(k \cdot j\right)\right) \cdot \sqrt{27.0}\right)\right)\\ \mathbf{elif}\;t \le 1.2057811127525296 \cdot 10^{-172}:\\ \;\;\;\;\mathsf{fma}\left(\left(-4.0\right) \cdot a, t, b \cdot c - \mathsf{fma}\left(4.0 \cdot i, x, \left(k \cdot j\right) \cdot 27.0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot \left(\left(\sqrt[3]{\left(x \cdot 18.0\right) \cdot z} \cdot \sqrt[3]{\left(x \cdot 18.0\right) \cdot z}\right) \cdot \sqrt[3]{\left(x \cdot 18.0\right) \cdot z}\right) - a \cdot 4.0, t, b \cdot c - \mathsf{fma}\left(4.0 \cdot i, x, \left(27.0 \cdot j\right) \cdot k\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}\;t \le -9.815254673950543 \cdot 10^{-140}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(x \cdot 18.0\right) \cdot z\right) \cdot y - a \cdot 4.0, t, b \cdot c - \mathsf{fma}\left(4.0 \cdot i, x, \left(\sqrt{27.0} \cdot \left(k \cdot j\right)\right) \cdot \sqrt{27.0}\right)\right)\\

\mathbf{elif}\;t \le 1.2057811127525296 \cdot 10^{-172}:\\
\;\;\;\;\mathsf{fma}\left(\left(-4.0\right) \cdot a, t, b \cdot c - \mathsf{fma}\left(4.0 \cdot i, x, \left(k \cdot j\right) \cdot 27.0\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y \cdot \left(\left(\sqrt[3]{\left(x \cdot 18.0\right) \cdot z} \cdot \sqrt[3]{\left(x \cdot 18.0\right) \cdot z}\right) \cdot \sqrt[3]{\left(x \cdot 18.0\right) \cdot z}\right) - a \cdot 4.0, t, b \cdot c - \mathsf{fma}\left(4.0 \cdot i, x, \left(27.0 \cdot j\right) \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 r12661622 = x;
        double r12661623 = 18.0;
        double r12661624 = r12661622 * r12661623;
        double r12661625 = y;
        double r12661626 = r12661624 * r12661625;
        double r12661627 = z;
        double r12661628 = r12661626 * r12661627;
        double r12661629 = t;
        double r12661630 = r12661628 * r12661629;
        double r12661631 = a;
        double r12661632 = 4.0;
        double r12661633 = r12661631 * r12661632;
        double r12661634 = r12661633 * r12661629;
        double r12661635 = r12661630 - r12661634;
        double r12661636 = b;
        double r12661637 = c;
        double r12661638 = r12661636 * r12661637;
        double r12661639 = r12661635 + r12661638;
        double r12661640 = r12661622 * r12661632;
        double r12661641 = i;
        double r12661642 = r12661640 * r12661641;
        double r12661643 = r12661639 - r12661642;
        double r12661644 = j;
        double r12661645 = 27.0;
        double r12661646 = r12661644 * r12661645;
        double r12661647 = k;
        double r12661648 = r12661646 * r12661647;
        double r12661649 = r12661643 - r12661648;
        return r12661649;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r12661650 = t;
        double r12661651 = -9.815254673950543e-140;
        bool r12661652 = r12661650 <= r12661651;
        double r12661653 = x;
        double r12661654 = 18.0;
        double r12661655 = r12661653 * r12661654;
        double r12661656 = z;
        double r12661657 = r12661655 * r12661656;
        double r12661658 = y;
        double r12661659 = r12661657 * r12661658;
        double r12661660 = a;
        double r12661661 = 4.0;
        double r12661662 = r12661660 * r12661661;
        double r12661663 = r12661659 - r12661662;
        double r12661664 = b;
        double r12661665 = c;
        double r12661666 = r12661664 * r12661665;
        double r12661667 = i;
        double r12661668 = r12661661 * r12661667;
        double r12661669 = 27.0;
        double r12661670 = sqrt(r12661669);
        double r12661671 = k;
        double r12661672 = j;
        double r12661673 = r12661671 * r12661672;
        double r12661674 = r12661670 * r12661673;
        double r12661675 = r12661674 * r12661670;
        double r12661676 = fma(r12661668, r12661653, r12661675);
        double r12661677 = r12661666 - r12661676;
        double r12661678 = fma(r12661663, r12661650, r12661677);
        double r12661679 = 1.2057811127525296e-172;
        bool r12661680 = r12661650 <= r12661679;
        double r12661681 = -r12661661;
        double r12661682 = r12661681 * r12661660;
        double r12661683 = r12661673 * r12661669;
        double r12661684 = fma(r12661668, r12661653, r12661683);
        double r12661685 = r12661666 - r12661684;
        double r12661686 = fma(r12661682, r12661650, r12661685);
        double r12661687 = cbrt(r12661657);
        double r12661688 = r12661687 * r12661687;
        double r12661689 = r12661688 * r12661687;
        double r12661690 = r12661658 * r12661689;
        double r12661691 = r12661690 - r12661662;
        double r12661692 = r12661669 * r12661672;
        double r12661693 = r12661692 * r12661671;
        double r12661694 = fma(r12661668, r12661653, r12661693);
        double r12661695 = r12661666 - r12661694;
        double r12661696 = fma(r12661691, r12661650, r12661695);
        double r12661697 = r12661680 ? r12661686 : r12661696;
        double r12661698 = r12661652 ? r12661678 : r12661697;
        return r12661698;
}

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

Target

Original5.7
Target1.8
Herbie4.3
\[\begin{array}{l} \mathbf{if}\;t \lt -1.6210815397541398 \cdot 10^{-69}:\\ \;\;\;\;\left(\left(18.0 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - \left(a \cdot t + i \cdot x\right) \cdot 4.0\right) - \left(\left(k \cdot j\right) \cdot 27.0 - c \cdot b\right)\\ \mathbf{elif}\;t \lt 165.68027943805222:\\ \;\;\;\;\left(\left(18.0 \cdot y\right) \cdot \left(x \cdot \left(z \cdot t\right)\right) - \left(a \cdot t + i \cdot x\right) \cdot 4.0\right) + \left(c \cdot b - 27.0 \cdot \left(k \cdot j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(18.0 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - \left(a \cdot t + i \cdot x\right) \cdot 4.0\right) - \left(\left(k \cdot j\right) \cdot 27.0 - c \cdot b\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if t < -9.815254673950543e-140

    1. Initial program 4.2

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y \cdot \left(z \cdot \left(x \cdot 18.0\right)\right) - a \cdot 4.0, t, c \cdot b - \color{blue}{\mathsf{fma}\left(i \cdot 4.0, x, \left(k \cdot j\right) \cdot 27.0\right)}\right)\]
    7. Using strategy rm
    8. Applied add-sqr-sqrt3.6

      \[\leadsto \mathsf{fma}\left(y \cdot \left(z \cdot \left(x \cdot 18.0\right)\right) - a \cdot 4.0, t, c \cdot b - \mathsf{fma}\left(i \cdot 4.0, x, \left(k \cdot j\right) \cdot \color{blue}{\left(\sqrt{27.0} \cdot \sqrt{27.0}\right)}\right)\right)\]
    9. Applied associate-*r*3.6

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

    if -9.815254673950543e-140 < t < 1.2057811127525296e-172

    1. Initial program 9.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. Simplified9.6

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

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

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

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

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

    if 1.2057811127525296e-172 < t

    1. Initial program 4.0

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(y \cdot \left(z \cdot \left(x \cdot 18.0\right)\right) - a \cdot 4.0, t, c \cdot b - \mathsf{fma}\left(i \cdot 4.0, x, \color{blue}{k \cdot \left(j \cdot 27.0\right)}\right)\right)\]
    9. Using strategy rm
    10. Applied add-cube-cbrt3.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -9.815254673950543 \cdot 10^{-140}:\\ \;\;\;\;\mathsf{fma}\left(\left(\left(x \cdot 18.0\right) \cdot z\right) \cdot y - a \cdot 4.0, t, b \cdot c - \mathsf{fma}\left(4.0 \cdot i, x, \left(\sqrt{27.0} \cdot \left(k \cdot j\right)\right) \cdot \sqrt{27.0}\right)\right)\\ \mathbf{elif}\;t \le 1.2057811127525296 \cdot 10^{-172}:\\ \;\;\;\;\mathsf{fma}\left(\left(-4.0\right) \cdot a, t, b \cdot c - \mathsf{fma}\left(4.0 \cdot i, x, \left(k \cdot j\right) \cdot 27.0\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(y \cdot \left(\left(\sqrt[3]{\left(x \cdot 18.0\right) \cdot z} \cdot \sqrt[3]{\left(x \cdot 18.0\right) \cdot z}\right) \cdot \sqrt[3]{\left(x \cdot 18.0\right) \cdot z}\right) - a \cdot 4.0, t, b \cdot c - \mathsf{fma}\left(4.0 \cdot i, x, \left(27.0 \cdot j\right) \cdot k\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019156 +o rules:numerics
(FPCore (x y z t a b c i j k)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, E"

  :herbie-target
  (if (< t -1.6210815397541398e-69) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b))) (if (< t 165.68027943805222) (+ (- (* (* 18.0 y) (* x (* z t))) (* (+ (* a t) (* i x)) 4.0)) (- (* c b) (* 27.0 (* k j)))) (- (- (* (* 18.0 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4.0)) (- (* (* k j) 27.0) (* c b)))))

  (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))