\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.35973034078404779 \cdot 10^{-109}:\\
\;\;\;\;\mathsf{fma}\left(t, {\left(\left(z \cdot y\right) \cdot \left(x \cdot 18\right)\right)}^{1} - a \cdot 4, \mathsf{fma}\left(b, c, -\mathsf{fma}\left(x, 4 \cdot i, j \cdot \left(27 \cdot k\right)\right)\right)\right)\\
\mathbf{elif}\;t \le 6.2161625191812012 \cdot 10^{-206}:\\
\;\;\;\;\mathsf{fma}\left(t, {0}^{1} - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, j \cdot \left(27 \cdot k\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \left(\left(\left(x \cdot 18\right) \cdot \left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right)\right) \cdot \sqrt[3]{y}\right) \cdot z - a \cdot 4, b \cdot c - \mathsf{fma}\left(x, 4 \cdot i, j \cdot \left(27 \cdot k\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 r801521 = x;
double r801522 = 18.0;
double r801523 = r801521 * r801522;
double r801524 = y;
double r801525 = r801523 * r801524;
double r801526 = z;
double r801527 = r801525 * r801526;
double r801528 = t;
double r801529 = r801527 * r801528;
double r801530 = a;
double r801531 = 4.0;
double r801532 = r801530 * r801531;
double r801533 = r801532 * r801528;
double r801534 = r801529 - r801533;
double r801535 = b;
double r801536 = c;
double r801537 = r801535 * r801536;
double r801538 = r801534 + r801537;
double r801539 = r801521 * r801531;
double r801540 = i;
double r801541 = r801539 * r801540;
double r801542 = r801538 - r801541;
double r801543 = j;
double r801544 = 27.0;
double r801545 = r801543 * r801544;
double r801546 = k;
double r801547 = r801545 * r801546;
double r801548 = r801542 - r801547;
return r801548;
}
double f(double x, double y, double z, double t, double a, double b, double c, double i, double j, double k) {
double r801549 = t;
double r801550 = -2.359730340784048e-109;
bool r801551 = r801549 <= r801550;
double r801552 = z;
double r801553 = y;
double r801554 = r801552 * r801553;
double r801555 = x;
double r801556 = 18.0;
double r801557 = r801555 * r801556;
double r801558 = r801554 * r801557;
double r801559 = 1.0;
double r801560 = pow(r801558, r801559);
double r801561 = a;
double r801562 = 4.0;
double r801563 = r801561 * r801562;
double r801564 = r801560 - r801563;
double r801565 = b;
double r801566 = c;
double r801567 = i;
double r801568 = r801562 * r801567;
double r801569 = j;
double r801570 = 27.0;
double r801571 = k;
double r801572 = r801570 * r801571;
double r801573 = r801569 * r801572;
double r801574 = fma(r801555, r801568, r801573);
double r801575 = -r801574;
double r801576 = fma(r801565, r801566, r801575);
double r801577 = fma(r801549, r801564, r801576);
double r801578 = 6.216162519181201e-206;
bool r801579 = r801549 <= r801578;
double r801580 = 0.0;
double r801581 = pow(r801580, r801559);
double r801582 = r801581 - r801563;
double r801583 = r801565 * r801566;
double r801584 = r801583 - r801574;
double r801585 = fma(r801549, r801582, r801584);
double r801586 = cbrt(r801553);
double r801587 = r801586 * r801586;
double r801588 = r801557 * r801587;
double r801589 = r801588 * r801586;
double r801590 = r801589 * r801552;
double r801591 = r801590 - r801563;
double r801592 = fma(r801549, r801591, r801584);
double r801593 = r801579 ? r801585 : r801592;
double r801594 = r801551 ? r801577 : r801593;
return r801594;
}




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
| Original | 5.6 |
|---|---|
| Target | 1.5 |
| Herbie | 4.7 |
if t < -2.359730340784048e-109Initial program 3.2
Simplified3.3
rmApplied associate-*l*3.4
rmApplied add-cube-cbrt3.5
Applied associate-*r*3.5
rmApplied pow13.5
Applied pow13.5
Applied pow13.5
Applied pow13.5
Applied pow-prod-down3.5
Applied pow13.5
Applied pow13.5
Applied pow-prod-down3.5
Applied pow-prod-down3.5
Applied pow-prod-down3.5
Applied pow-prod-down3.5
Simplified3.4
rmApplied fma-neg3.4
if -2.359730340784048e-109 < t < 6.216162519181201e-206Initial program 9.6
Simplified9.6
rmApplied associate-*l*9.7
rmApplied add-cube-cbrt9.7
Applied associate-*r*9.7
rmApplied pow19.7
Applied pow19.7
Applied pow19.7
Applied pow19.7
Applied pow-prod-down9.7
Applied pow19.7
Applied pow19.7
Applied pow-prod-down9.7
Applied pow-prod-down9.7
Applied pow-prod-down9.7
Applied pow-prod-down9.7
Simplified10.2
Taylor expanded around 0 6.2
if 6.216162519181201e-206 < t Initial program 4.2
Simplified4.2
rmApplied associate-*l*4.3
rmApplied add-cube-cbrt4.4
Applied associate-*r*4.4
Final simplification4.7
herbie shell --seed 2020035 +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)))