Average Error: 5.5 → 1.0
Time: 39.8s
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}\;\left(\left(\left(t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \left(a \cdot 4\right) \cdot t\right) + c \cdot b\right) - \left(x \cdot 4\right) \cdot i\right) - \left(27 \cdot j\right) \cdot k = -\infty:\\ \;\;\;\;\mathsf{fma}\left(b, c, 18 \cdot \left(y \cdot \left(z \cdot \left(t \cdot x\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \sqrt[3]{j} \cdot \left(\left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(k \cdot 27\right)\right)\right)\right)\\ \mathbf{elif}\;\left(\left(\left(t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \left(a \cdot 4\right) \cdot t\right) + c \cdot b\right) - \left(x \cdot 4\right) \cdot i\right) - \left(27 \cdot j\right) \cdot k \le 5.292429442197061463553396675246931672241 \cdot 10^{278}:\\ \;\;\;\;\left(\left(\left(t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \left(a \cdot 4\right) \cdot t\right) + c \cdot b\right) - \left(x \cdot 4\right) \cdot i\right) - \left(27 \cdot j\right) \cdot k\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, 18 \cdot \left(y \cdot \left(x \cdot \left(t \cdot z\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot 27\right) \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}\;\left(\left(\left(t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \left(a \cdot 4\right) \cdot t\right) + c \cdot b\right) - \left(x \cdot 4\right) \cdot i\right) - \left(27 \cdot j\right) \cdot k = -\infty:\\
\;\;\;\;\mathsf{fma}\left(b, c, 18 \cdot \left(y \cdot \left(z \cdot \left(t \cdot x\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \sqrt[3]{j} \cdot \left(\left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(k \cdot 27\right)\right)\right)\right)\\

\mathbf{elif}\;\left(\left(\left(t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \left(a \cdot 4\right) \cdot t\right) + c \cdot b\right) - \left(x \cdot 4\right) \cdot i\right) - \left(27 \cdot j\right) \cdot k \le 5.292429442197061463553396675246931672241 \cdot 10^{278}:\\
\;\;\;\;\left(\left(\left(t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \left(a \cdot 4\right) \cdot t\right) + c \cdot b\right) - \left(x \cdot 4\right) \cdot i\right) - \left(27 \cdot j\right) \cdot k\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, c, 18 \cdot \left(y \cdot \left(x \cdot \left(t \cdot z\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot 27\right) \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 r37638247 = x;
        double r37638248 = 18.0;
        double r37638249 = r37638247 * r37638248;
        double r37638250 = y;
        double r37638251 = r37638249 * r37638250;
        double r37638252 = z;
        double r37638253 = r37638251 * r37638252;
        double r37638254 = t;
        double r37638255 = r37638253 * r37638254;
        double r37638256 = a;
        double r37638257 = 4.0;
        double r37638258 = r37638256 * r37638257;
        double r37638259 = r37638258 * r37638254;
        double r37638260 = r37638255 - r37638259;
        double r37638261 = b;
        double r37638262 = c;
        double r37638263 = r37638261 * r37638262;
        double r37638264 = r37638260 + r37638263;
        double r37638265 = r37638247 * r37638257;
        double r37638266 = i;
        double r37638267 = r37638265 * r37638266;
        double r37638268 = r37638264 - r37638267;
        double r37638269 = j;
        double r37638270 = 27.0;
        double r37638271 = r37638269 * r37638270;
        double r37638272 = k;
        double r37638273 = r37638271 * r37638272;
        double r37638274 = r37638268 - r37638273;
        return r37638274;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r37638275 = t;
        double r37638276 = x;
        double r37638277 = 18.0;
        double r37638278 = r37638276 * r37638277;
        double r37638279 = y;
        double r37638280 = r37638278 * r37638279;
        double r37638281 = z;
        double r37638282 = r37638280 * r37638281;
        double r37638283 = r37638275 * r37638282;
        double r37638284 = a;
        double r37638285 = 4.0;
        double r37638286 = r37638284 * r37638285;
        double r37638287 = r37638286 * r37638275;
        double r37638288 = r37638283 - r37638287;
        double r37638289 = c;
        double r37638290 = b;
        double r37638291 = r37638289 * r37638290;
        double r37638292 = r37638288 + r37638291;
        double r37638293 = r37638276 * r37638285;
        double r37638294 = i;
        double r37638295 = r37638293 * r37638294;
        double r37638296 = r37638292 - r37638295;
        double r37638297 = 27.0;
        double r37638298 = j;
        double r37638299 = r37638297 * r37638298;
        double r37638300 = k;
        double r37638301 = r37638299 * r37638300;
        double r37638302 = r37638296 - r37638301;
        double r37638303 = -inf.0;
        bool r37638304 = r37638302 <= r37638303;
        double r37638305 = r37638275 * r37638276;
        double r37638306 = r37638281 * r37638305;
        double r37638307 = r37638279 * r37638306;
        double r37638308 = r37638277 * r37638307;
        double r37638309 = r37638276 * r37638294;
        double r37638310 = fma(r37638275, r37638284, r37638309);
        double r37638311 = cbrt(r37638298);
        double r37638312 = r37638311 * r37638311;
        double r37638313 = r37638300 * r37638297;
        double r37638314 = r37638312 * r37638313;
        double r37638315 = r37638311 * r37638314;
        double r37638316 = fma(r37638285, r37638310, r37638315);
        double r37638317 = r37638308 - r37638316;
        double r37638318 = fma(r37638290, r37638289, r37638317);
        double r37638319 = 5.2924294421970615e+278;
        bool r37638320 = r37638302 <= r37638319;
        double r37638321 = r37638275 * r37638281;
        double r37638322 = r37638276 * r37638321;
        double r37638323 = r37638279 * r37638322;
        double r37638324 = r37638277 * r37638323;
        double r37638325 = r37638313 * r37638298;
        double r37638326 = fma(r37638285, r37638310, r37638325);
        double r37638327 = r37638324 - r37638326;
        double r37638328 = fma(r37638290, r37638289, r37638327);
        double r37638329 = r37638320 ? r37638302 : r37638328;
        double r37638330 = r37638304 ? r37638318 : r37638329;
        return r37638330;
}

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.4
Herbie1.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 (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)) < -inf.0

    1. Initial program 64.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. Simplified13.1

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

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

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

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

      \[\leadsto \mathsf{fma}\left(b, c, \left(\left(z \cdot \left(t \cdot x\right)\right) \cdot y\right) \cdot 18 - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(27 \cdot k\right) \cdot \color{blue}{\left(\left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \sqrt[3]{j}\right)}\right)\right)\]
    11. Applied associate-*r*4.7

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

    if -inf.0 < (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)) < 5.2924294421970615e+278

    1. Initial program 0.3

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

    if 5.2924294421970615e+278 < (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k))

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\left(\left(\left(t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \left(a \cdot 4\right) \cdot t\right) + c \cdot b\right) - \left(x \cdot 4\right) \cdot i\right) - \left(27 \cdot j\right) \cdot k = -\infty:\\ \;\;\;\;\mathsf{fma}\left(b, c, 18 \cdot \left(y \cdot \left(z \cdot \left(t \cdot x\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \sqrt[3]{j} \cdot \left(\left(\sqrt[3]{j} \cdot \sqrt[3]{j}\right) \cdot \left(k \cdot 27\right)\right)\right)\right)\\ \mathbf{elif}\;\left(\left(\left(t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \left(a \cdot 4\right) \cdot t\right) + c \cdot b\right) - \left(x \cdot 4\right) \cdot i\right) - \left(27 \cdot j\right) \cdot k \le 5.292429442197061463553396675246931672241 \cdot 10^{278}:\\ \;\;\;\;\left(\left(\left(t \cdot \left(\left(\left(x \cdot 18\right) \cdot y\right) \cdot z\right) - \left(a \cdot 4\right) \cdot t\right) + c \cdot b\right) - \left(x \cdot 4\right) \cdot i\right) - \left(27 \cdot j\right) \cdot k\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, 18 \cdot \left(y \cdot \left(x \cdot \left(t \cdot z\right)\right)\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot 27\right) \cdot j\right)\right)\\ \end{array}\]

Reproduce

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