Average Error: 5.5 → 3.9
Time: 28.1s
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 -4.802521353136590134090568041763149695323 \cdot 10^{-178}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(\left(y \cdot x\right) \cdot 18\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)\\ \mathbf{elif}\;t \le 4.339340101075432744492970777980355608709 \cdot 10^{-63}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(x \cdot 18\right) \cdot y\right) \cdot \left(t \cdot z\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \cdot k\right) \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(x \cdot 18\right) \cdot \left(y \cdot z\right)\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \cdot k\right) \cdot j\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 -4.802521353136590134090568041763149695323 \cdot 10^{-178}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(\left(\left(y \cdot x\right) \cdot 18\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)\\

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, b, \left(\left(x \cdot 18\right) \cdot \left(y \cdot z\right)\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \cdot k\right) \cdot j\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 r571787 = x;
        double r571788 = 18.0;
        double r571789 = r571787 * r571788;
        double r571790 = y;
        double r571791 = r571789 * r571790;
        double r571792 = z;
        double r571793 = r571791 * r571792;
        double r571794 = t;
        double r571795 = r571793 * r571794;
        double r571796 = a;
        double r571797 = 4.0;
        double r571798 = r571796 * r571797;
        double r571799 = r571798 * r571794;
        double r571800 = r571795 - r571799;
        double r571801 = b;
        double r571802 = c;
        double r571803 = r571801 * r571802;
        double r571804 = r571800 + r571803;
        double r571805 = r571787 * r571797;
        double r571806 = i;
        double r571807 = r571805 * r571806;
        double r571808 = r571804 - r571807;
        double r571809 = j;
        double r571810 = 27.0;
        double r571811 = r571809 * r571810;
        double r571812 = k;
        double r571813 = r571811 * r571812;
        double r571814 = r571808 - r571813;
        return r571814;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r571815 = t;
        double r571816 = -4.80252135313659e-178;
        bool r571817 = r571815 <= r571816;
        double r571818 = c;
        double r571819 = b;
        double r571820 = y;
        double r571821 = x;
        double r571822 = r571820 * r571821;
        double r571823 = 18.0;
        double r571824 = r571822 * r571823;
        double r571825 = z;
        double r571826 = r571824 * r571825;
        double r571827 = r571826 * r571815;
        double r571828 = fma(r571818, r571819, r571827);
        double r571829 = 4.0;
        double r571830 = a;
        double r571831 = i;
        double r571832 = r571821 * r571831;
        double r571833 = fma(r571815, r571830, r571832);
        double r571834 = j;
        double r571835 = 27.0;
        double r571836 = r571834 * r571835;
        double r571837 = k;
        double r571838 = r571836 * r571837;
        double r571839 = fma(r571829, r571833, r571838);
        double r571840 = r571828 - r571839;
        double r571841 = 4.339340101075433e-63;
        bool r571842 = r571815 <= r571841;
        double r571843 = r571821 * r571823;
        double r571844 = r571843 * r571820;
        double r571845 = r571815 * r571825;
        double r571846 = r571844 * r571845;
        double r571847 = fma(r571818, r571819, r571846);
        double r571848 = r571835 * r571837;
        double r571849 = r571848 * r571834;
        double r571850 = fma(r571829, r571833, r571849);
        double r571851 = r571847 - r571850;
        double r571852 = r571820 * r571825;
        double r571853 = r571843 * r571852;
        double r571854 = r571853 * r571815;
        double r571855 = fma(r571818, r571819, r571854);
        double r571856 = r571855 - r571850;
        double r571857 = r571842 ? r571851 : r571856;
        double r571858 = r571817 ? r571840 : r571857;
        return r571858;
}

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.5
Target1.6
Herbie3.9
\[\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 t < -4.80252135313659e-178

    1. Initial program 4.0

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

      \[\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 associate-*l*4.0

      \[\leadsto \mathsf{fma}\left(c, b, \left(\color{blue}{\left(x \cdot \left(18 \cdot y\right)\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)\]
    5. Simplified4.0

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(x \cdot \color{blue}{\left(y \cdot 18\right)}\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)\]
    6. Using strategy rm
    7. Applied associate-*r*3.9

      \[\leadsto \mathsf{fma}\left(c, b, \left(\color{blue}{\left(\left(x \cdot y\right) \cdot 18\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)\]
    8. Simplified3.9

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

    if -4.80252135313659e-178 < t < 4.339340101075433e-63

    1. Initial program 8.5

      \[\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.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 pow18.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 pow18.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 pow18.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-down8.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-down8.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. Simplified8.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), {\color{blue}{\left(j \cdot \left(27 \cdot k\right)\right)}}^{1}\right)\]
    10. Using strategy rm
    11. Applied associate-*l*4.4

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

      \[\leadsto \mathsf{fma}\left(c, b, \left(\left(x \cdot 18\right) \cdot y\right) \cdot \color{blue}{\left(t \cdot z\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 4.339340101075433e-63 < t

    1. Initial program 3.0

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(c, b, \color{blue}{\left(\left(x \cdot 18\right) \cdot \left(y \cdot z\right)\right)} \cdot t\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)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -4.802521353136590134090568041763149695323 \cdot 10^{-178}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(\left(y \cdot x\right) \cdot 18\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)\\ \mathbf{elif}\;t \le 4.339340101075432744492970777980355608709 \cdot 10^{-63}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(x \cdot 18\right) \cdot y\right) \cdot \left(t \cdot z\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \cdot k\right) \cdot j\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(c, b, \left(\left(x \cdot 18\right) \cdot \left(y \cdot z\right)\right) \cdot t\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \cdot k\right) \cdot j\right)\\ \end{array}\]

Reproduce

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