Average Error: 5.7 → 4.0
Time: 28.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 -3.624852689735996891647709392603199582496 \cdot 10^{-74}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(x \cdot 18\right) \cdot y\right) \cdot \left(z \cdot t\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), j \cdot \left(27 \cdot k\right)\right)\\ \mathbf{elif}\;z \le 2.780589155175302159079260840210876793124 \cdot 10^{-77}:\\ \;\;\;\;\mathsf{fma}\left(c, b, 18 \cdot \left(t \cdot \left(x \cdot \left(z \cdot y\right)\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), j \cdot \left(27 \cdot k\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(k \cdot j\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 -3.624852689735996891647709392603199582496 \cdot 10^{-74}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(\left(x \cdot 18\right) \cdot y\right) \cdot \left(z \cdot t\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), j \cdot \left(27 \cdot k\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(k \cdot j\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 r562787 = x;
        double r562788 = 18.0;
        double r562789 = r562787 * r562788;
        double r562790 = y;
        double r562791 = r562789 * r562790;
        double r562792 = z;
        double r562793 = r562791 * r562792;
        double r562794 = t;
        double r562795 = r562793 * r562794;
        double r562796 = a;
        double r562797 = 4.0;
        double r562798 = r562796 * r562797;
        double r562799 = r562798 * r562794;
        double r562800 = r562795 - r562799;
        double r562801 = b;
        double r562802 = c;
        double r562803 = r562801 * r562802;
        double r562804 = r562800 + r562803;
        double r562805 = r562787 * r562797;
        double r562806 = i;
        double r562807 = r562805 * r562806;
        double r562808 = r562804 - r562807;
        double r562809 = j;
        double r562810 = 27.0;
        double r562811 = r562809 * r562810;
        double r562812 = k;
        double r562813 = r562811 * r562812;
        double r562814 = r562808 - r562813;
        return r562814;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r562815 = z;
        double r562816 = -3.624852689735997e-74;
        bool r562817 = r562815 <= r562816;
        double r562818 = c;
        double r562819 = b;
        double r562820 = x;
        double r562821 = 18.0;
        double r562822 = r562820 * r562821;
        double r562823 = y;
        double r562824 = r562822 * r562823;
        double r562825 = t;
        double r562826 = r562815 * r562825;
        double r562827 = r562824 * r562826;
        double r562828 = fma(r562818, r562819, r562827);
        double r562829 = 4.0;
        double r562830 = a;
        double r562831 = i;
        double r562832 = r562820 * r562831;
        double r562833 = fma(r562825, r562830, r562832);
        double r562834 = j;
        double r562835 = 27.0;
        double r562836 = k;
        double r562837 = r562835 * r562836;
        double r562838 = r562834 * r562837;
        double r562839 = fma(r562829, r562833, r562838);
        double r562840 = r562828 - r562839;
        double r562841 = 2.780589155175302e-77;
        bool r562842 = r562815 <= r562841;
        double r562843 = r562815 * r562823;
        double r562844 = r562820 * r562843;
        double r562845 = r562825 * r562844;
        double r562846 = r562821 * r562845;
        double r562847 = fma(r562818, r562819, r562846);
        double r562848 = r562847 - r562839;
        double r562849 = r562824 * r562815;
        double r562850 = r562849 * r562825;
        double r562851 = fma(r562818, r562819, r562850);
        double r562852 = r562836 * r562834;
        double r562853 = r562835 * r562852;
        double r562854 = fma(r562829, r562833, r562853);
        double r562855 = r562851 - r562854;
        double r562856 = r562842 ? r562848 : r562855;
        double r562857 = r562817 ? r562840 : r562856;
        return r562857;
}

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.7
Herbie4.0
\[\begin{array}{l} \mathbf{if}\;t \lt -1.62108153975413982700795070153457058168 \cdot 10^{-69}:\\ \;\;\;\;\left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - \left(a \cdot t + i \cdot x\right) \cdot 4\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\ \mathbf{elif}\;t \lt 165.6802794380522243500308832153677940369:\\ \;\;\;\;\left(\left(18 \cdot y\right) \cdot \left(x \cdot \left(z \cdot t\right)\right) - \left(a \cdot t + i \cdot x\right) \cdot 4\right) + \left(c \cdot b - 27 \cdot \left(k \cdot j\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(18 \cdot t\right) \cdot \left(\left(x \cdot y\right) \cdot z\right) - \left(a \cdot t + i \cdot x\right) \cdot 4\right) - \left(\left(k \cdot j\right) \cdot 27 - c \cdot b\right)\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if z < -3.624852689735997e-74

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

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

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(\color{blue}{{j}^{1}} \cdot {27}^{1}\right) \cdot {k}^{1}\right)\]
    7. Applied pow-prod-down6.1

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \color{blue}{{\left(j \cdot 27\right)}^{1}} \cdot {k}^{1}\right)\]
    8. Applied pow-prod-down6.1

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

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

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

    if -3.624852689735997e-74 < z < 2.780589155175302e-77

    1. Initial program 4.8

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

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

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(\color{blue}{{j}^{1}} \cdot {27}^{1}\right) \cdot {k}^{1}\right)\]
    7. Applied pow-prod-down4.7

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \color{blue}{{\left(j \cdot 27\right)}^{1}} \cdot {k}^{1}\right)\]
    8. Applied pow-prod-down4.7

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

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

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

    if 2.780589155175302e-77 < z

    1. Initial program 6.6

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

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

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(\color{blue}{{j}^{1}} \cdot {27}^{1}\right) \cdot {k}^{1}\right)\]
    7. Applied pow-prod-down6.5

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \color{blue}{{\left(j \cdot 27\right)}^{1}} \cdot {k}^{1}\right)\]
    8. Applied pow-prod-down6.5

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

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), {\color{blue}{\left(j \cdot \left(27 \cdot k\right)\right)}}^{1}\right)\]
    10. Using strategy rm
    11. Applied *-un-lft-identity6.6

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), {\left(\color{blue}{\left(1 \cdot j\right)} \cdot \left(27 \cdot k\right)\right)}^{1}\right)\]
    12. Applied associate-*l*6.6

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

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

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

Reproduce

herbie shell --seed 2019212 +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"
  :precision binary64

  :herbie-target
  (if (< t -1.6210815397541398e-69) (- (- (* (* 18 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4)) (- (* (* k j) 27) (* c b))) (if (< t 165.680279438052224) (+ (- (* (* 18 y) (* x (* z t))) (* (+ (* a t) (* i x)) 4)) (- (* c b) (* 27 (* k j)))) (- (- (* (* 18 t) (* (* x y) z)) (* (+ (* a t) (* i x)) 4)) (- (* (* k j) 27) (* c b)))))

  (- (- (+ (- (* (* (* (* x 18) y) z) t) (* (* a 4) t)) (* b c)) (* (* x 4) i)) (* (* j 27) k)))