Average Error: 5.5 → 0.8
Time: 1.1m
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, \left(\left(t \cdot z\right) \cdot \left(y \cdot 18\right)\right) \cdot x - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot j\right) \cdot 27\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 2.091817559392553810929566838550160622791 \cdot 10^{304}:\\ \;\;\;\;\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, \left(\left(t \cdot z\right) \cdot \left(y \cdot 18\right)\right) \cdot x - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot j\right) \cdot 27\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, \left(\left(t \cdot z\right) \cdot \left(y \cdot 18\right)\right) \cdot x - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot j\right) \cdot 27\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 2.091817559392553810929566838550160622791 \cdot 10^{304}:\\
\;\;\;\;\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, \left(\left(t \cdot z\right) \cdot \left(y \cdot 18\right)\right) \cdot x - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot j\right) \cdot 27\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 r34355328 = x;
        double r34355329 = 18.0;
        double r34355330 = r34355328 * r34355329;
        double r34355331 = y;
        double r34355332 = r34355330 * r34355331;
        double r34355333 = z;
        double r34355334 = r34355332 * r34355333;
        double r34355335 = t;
        double r34355336 = r34355334 * r34355335;
        double r34355337 = a;
        double r34355338 = 4.0;
        double r34355339 = r34355337 * r34355338;
        double r34355340 = r34355339 * r34355335;
        double r34355341 = r34355336 - r34355340;
        double r34355342 = b;
        double r34355343 = c;
        double r34355344 = r34355342 * r34355343;
        double r34355345 = r34355341 + r34355344;
        double r34355346 = r34355328 * r34355338;
        double r34355347 = i;
        double r34355348 = r34355346 * r34355347;
        double r34355349 = r34355345 - r34355348;
        double r34355350 = j;
        double r34355351 = 27.0;
        double r34355352 = r34355350 * r34355351;
        double r34355353 = k;
        double r34355354 = r34355352 * r34355353;
        double r34355355 = r34355349 - r34355354;
        return r34355355;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r34355356 = t;
        double r34355357 = x;
        double r34355358 = 18.0;
        double r34355359 = r34355357 * r34355358;
        double r34355360 = y;
        double r34355361 = r34355359 * r34355360;
        double r34355362 = z;
        double r34355363 = r34355361 * r34355362;
        double r34355364 = r34355356 * r34355363;
        double r34355365 = a;
        double r34355366 = 4.0;
        double r34355367 = r34355365 * r34355366;
        double r34355368 = r34355367 * r34355356;
        double r34355369 = r34355364 - r34355368;
        double r34355370 = c;
        double r34355371 = b;
        double r34355372 = r34355370 * r34355371;
        double r34355373 = r34355369 + r34355372;
        double r34355374 = r34355357 * r34355366;
        double r34355375 = i;
        double r34355376 = r34355374 * r34355375;
        double r34355377 = r34355373 - r34355376;
        double r34355378 = 27.0;
        double r34355379 = j;
        double r34355380 = r34355378 * r34355379;
        double r34355381 = k;
        double r34355382 = r34355380 * r34355381;
        double r34355383 = r34355377 - r34355382;
        double r34355384 = -inf.0;
        bool r34355385 = r34355383 <= r34355384;
        double r34355386 = r34355356 * r34355362;
        double r34355387 = r34355360 * r34355358;
        double r34355388 = r34355386 * r34355387;
        double r34355389 = r34355388 * r34355357;
        double r34355390 = r34355357 * r34355375;
        double r34355391 = fma(r34355356, r34355365, r34355390);
        double r34355392 = r34355381 * r34355379;
        double r34355393 = r34355392 * r34355378;
        double r34355394 = fma(r34355366, r34355391, r34355393);
        double r34355395 = r34355389 - r34355394;
        double r34355396 = fma(r34355371, r34355370, r34355395);
        double r34355397 = 2.0918175593925538e+304;
        bool r34355398 = r34355383 <= r34355397;
        double r34355399 = r34355398 ? r34355383 : r34355396;
        double r34355400 = r34355385 ? r34355396 : r34355399;
        return r34355400;
}

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.7
Herbie0.8
\[\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 2 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 or 2.0918175593925538e+304 < (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k))

    1. Initial program 58.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. Simplified15.4

      \[\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. Taylor expanded around inf 11.3

      \[\leadsto \mathsf{fma}\left(b, c, \color{blue}{\left(t \cdot \left(x \cdot z\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)\]
    6. Using strategy rm
    7. Applied add-cube-cbrt11.7

      \[\leadsto \mathsf{fma}\left(b, c, \color{blue}{\left(\left(\sqrt[3]{t \cdot \left(x \cdot z\right)} \cdot \sqrt[3]{t \cdot \left(x \cdot z\right)}\right) \cdot \sqrt[3]{t \cdot \left(x \cdot z\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)\]
    8. Using strategy rm
    9. Applied pow111.7

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(b, c, {\color{blue}{\left(x \cdot \left(\left(t \cdot z\right) \cdot \left(y \cdot 18\right)\right)\right)}}^{1} - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), 27 \cdot \left(k \cdot j\right)\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)) < 2.0918175593925538e+304

    1. Initial program 0.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\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.8

    \[\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, \left(\left(t \cdot z\right) \cdot \left(y \cdot 18\right)\right) \cdot x - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot j\right) \cdot 27\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 2.091817559392553810929566838550160622791 \cdot 10^{304}:\\ \;\;\;\;\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, \left(\left(t \cdot z\right) \cdot \left(y \cdot 18\right)\right) \cdot x - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, x \cdot i\right), \left(k \cdot j\right) \cdot 27\right)\right)\\ \end{array}\]

Reproduce

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