Average Error: 5.6 → 4.4
Time: 18.6s
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 -2.984753943024447 \cdot 10^{-166}:\\ \;\;\;\;\mathsf{fma}\left(t, {\left(18 \cdot \left(\left(x \cdot z\right) \cdot y\right)\right)}^{1} - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\right) \cdot k\right)\right)\\ \mathbf{elif}\;t \le 4.6506436021600571 \cdot 10^{-67}:\\ \;\;\;\;\mathsf{fma}\left(t, {0}^{1} - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\right) \cdot k\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left({\left(18 \cdot \left(x \cdot \left(z \cdot y\right)\right)\right)}^{1} - a \cdot 4\right) + \left(b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\right) \cdot k\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 -2.984753943024447 \cdot 10^{-166}:\\
\;\;\;\;\mathsf{fma}\left(t, {\left(18 \cdot \left(\left(x \cdot z\right) \cdot y\right)\right)}^{1} - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\right) \cdot k\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;t \cdot \left({\left(18 \cdot \left(x \cdot \left(z \cdot y\right)\right)\right)}^{1} - a \cdot 4\right) + \left(b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, \left(j \cdot 27\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 r679781 = x;
        double r679782 = 18.0;
        double r679783 = r679781 * r679782;
        double r679784 = y;
        double r679785 = r679783 * r679784;
        double r679786 = z;
        double r679787 = r679785 * r679786;
        double r679788 = t;
        double r679789 = r679787 * r679788;
        double r679790 = a;
        double r679791 = 4.0;
        double r679792 = r679790 * r679791;
        double r679793 = r679792 * r679788;
        double r679794 = r679789 - r679793;
        double r679795 = b;
        double r679796 = c;
        double r679797 = r679795 * r679796;
        double r679798 = r679794 + r679797;
        double r679799 = r679781 * r679791;
        double r679800 = i;
        double r679801 = r679799 * r679800;
        double r679802 = r679798 - r679801;
        double r679803 = j;
        double r679804 = 27.0;
        double r679805 = r679803 * r679804;
        double r679806 = k;
        double r679807 = r679805 * r679806;
        double r679808 = r679802 - r679807;
        return r679808;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r679809 = t;
        double r679810 = -2.984753943024447e-166;
        bool r679811 = r679809 <= r679810;
        double r679812 = 18.0;
        double r679813 = x;
        double r679814 = z;
        double r679815 = r679813 * r679814;
        double r679816 = y;
        double r679817 = r679815 * r679816;
        double r679818 = r679812 * r679817;
        double r679819 = 1.0;
        double r679820 = pow(r679818, r679819);
        double r679821 = a;
        double r679822 = 4.0;
        double r679823 = r679821 * r679822;
        double r679824 = r679820 - r679823;
        double r679825 = b;
        double r679826 = c;
        double r679827 = r679825 * r679826;
        double r679828 = i;
        double r679829 = r679822 * r679828;
        double r679830 = j;
        double r679831 = 27.0;
        double r679832 = r679830 * r679831;
        double r679833 = k;
        double r679834 = r679832 * r679833;
        double r679835 = fma(r679813, r679829, r679834);
        double r679836 = r679827 - r679835;
        double r679837 = fma(r679809, r679824, r679836);
        double r679838 = 4.650643602160057e-67;
        bool r679839 = r679809 <= r679838;
        double r679840 = 0.0;
        double r679841 = pow(r679840, r679819);
        double r679842 = r679841 - r679823;
        double r679843 = fma(r679809, r679842, r679836);
        double r679844 = r679814 * r679816;
        double r679845 = r679813 * r679844;
        double r679846 = r679812 * r679845;
        double r679847 = pow(r679846, r679819);
        double r679848 = r679847 - r679823;
        double r679849 = r679809 * r679848;
        double r679850 = r679849 + r679836;
        double r679851 = r679839 ? r679843 : r679850;
        double r679852 = r679811 ? r679837 : r679851;
        return r679852;
}

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.6
Target1.5
Herbie4.4
\[\begin{array}{l} \mathbf{if}\;t \lt -1.6210815397541398 \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.680279438052224:\\ \;\;\;\;\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 < -2.984753943024447e-166

    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. Simplified4.1

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

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

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

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

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

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

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

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

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

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

    if -2.984753943024447e-166 < t < 4.650643602160057e-67

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

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

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

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

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

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

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

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

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

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

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

    if 4.650643602160057e-67 < t

    1. Initial program 2.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. 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 pow12.5

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

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

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

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2020033 +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.68027943805222) (+ (- (* (* 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)))