Average Error: 5.8 → 4.6
Time: 25.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}\;a \le -1.632674279572852805744165661391520813778 \cdot 10^{-107} \lor \neg \left(a \le 2.060057951131695727792287281528970479955 \cdot 10^{-135}\right):\\ \;\;\;\;\mathsf{fma}\left(b, c, 18 \cdot \left(\left(z \cdot \left(t \cdot x\right)\right) \cdot y\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), k \cdot \left(27 \cdot j\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(z \cdot \left(x \cdot \left(y \cdot 18\right)\right)\right) \cdot t - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), k \cdot \left(27 \cdot j\right)\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}\;a \le -1.632674279572852805744165661391520813778 \cdot 10^{-107} \lor \neg \left(a \le 2.060057951131695727792287281528970479955 \cdot 10^{-135}\right):\\
\;\;\;\;\mathsf{fma}\left(b, c, 18 \cdot \left(\left(z \cdot \left(t \cdot x\right)\right) \cdot y\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), k \cdot \left(27 \cdot j\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, c, \left(z \cdot \left(x \cdot \left(y \cdot 18\right)\right)\right) \cdot t - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), k \cdot \left(27 \cdot j\right)\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 r115291 = x;
        double r115292 = 18.0;
        double r115293 = r115291 * r115292;
        double r115294 = y;
        double r115295 = r115293 * r115294;
        double r115296 = z;
        double r115297 = r115295 * r115296;
        double r115298 = t;
        double r115299 = r115297 * r115298;
        double r115300 = a;
        double r115301 = 4.0;
        double r115302 = r115300 * r115301;
        double r115303 = r115302 * r115298;
        double r115304 = r115299 - r115303;
        double r115305 = b;
        double r115306 = c;
        double r115307 = r115305 * r115306;
        double r115308 = r115304 + r115307;
        double r115309 = r115291 * r115301;
        double r115310 = i;
        double r115311 = r115309 * r115310;
        double r115312 = r115308 - r115311;
        double r115313 = j;
        double r115314 = 27.0;
        double r115315 = r115313 * r115314;
        double r115316 = k;
        double r115317 = r115315 * r115316;
        double r115318 = r115312 - r115317;
        return r115318;
}

double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
        double r115319 = a;
        double r115320 = -1.6326742795728528e-107;
        bool r115321 = r115319 <= r115320;
        double r115322 = 2.0600579511316957e-135;
        bool r115323 = r115319 <= r115322;
        double r115324 = !r115323;
        bool r115325 = r115321 || r115324;
        double r115326 = b;
        double r115327 = c;
        double r115328 = 18.0;
        double r115329 = z;
        double r115330 = t;
        double r115331 = x;
        double r115332 = r115330 * r115331;
        double r115333 = r115329 * r115332;
        double r115334 = y;
        double r115335 = r115333 * r115334;
        double r115336 = r115328 * r115335;
        double r115337 = 4.0;
        double r115338 = i;
        double r115339 = r115338 * r115331;
        double r115340 = fma(r115330, r115319, r115339);
        double r115341 = k;
        double r115342 = 27.0;
        double r115343 = j;
        double r115344 = r115342 * r115343;
        double r115345 = r115341 * r115344;
        double r115346 = fma(r115337, r115340, r115345);
        double r115347 = r115336 - r115346;
        double r115348 = fma(r115326, r115327, r115347);
        double r115349 = r115334 * r115328;
        double r115350 = r115331 * r115349;
        double r115351 = r115329 * r115350;
        double r115352 = r115351 * r115330;
        double r115353 = r115352 - r115346;
        double r115354 = fma(r115326, r115327, r115353);
        double r115355 = r115325 ? r115348 : r115354;
        return r115355;
}

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

Derivation

  1. Split input into 2 regimes
  2. if a < -1.6326742795728528e-107 or 2.0600579511316957e-135 < a

    1. Initial program 5.9

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.6326742795728528e-107 < a < 2.0600579511316957e-135

    1. Initial program 5.7

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -1.632674279572852805744165661391520813778 \cdot 10^{-107} \lor \neg \left(a \le 2.060057951131695727792287281528970479955 \cdot 10^{-135}\right):\\ \;\;\;\;\mathsf{fma}\left(b, c, 18 \cdot \left(\left(z \cdot \left(t \cdot x\right)\right) \cdot y\right) - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), k \cdot \left(27 \cdot j\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(b, c, \left(z \cdot \left(x \cdot \left(y \cdot 18\right)\right)\right) \cdot t - \mathsf{fma}\left(4, \mathsf{fma}\left(t, a, i \cdot x\right), k \cdot \left(27 \cdot j\right)\right)\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019195 +o rules:numerics
(FPCore (x y z t a b c i j k)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1"
  (- (- (+ (- (* (* (* (* x 18.0) y) z) t) (* (* a 4.0) t)) (* b c)) (* (* x 4.0) i)) (* (* j 27.0) k)))