Average Error: 52.5 → 51.0
Time: 37.9s
Precision: 64
\[4.930380657631324 \cdot 10^{-32} \lt a \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt b \lt 2.028240960365167 \cdot 10^{+31} \land 4.930380657631324 \cdot 10^{-32} \lt c \lt 2.028240960365167 \cdot 10^{+31}\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 25771811432519.14:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\sqrt[3]{\sqrt[3]{\left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \left(\left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right)\right)} \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}}\right), \left(-b\right)\right)}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\frac{\frac{-3}{2} \cdot c}{b}} \cdot \sqrt[3]{\frac{1}{3}}\right) \cdot \left(\sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}} \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}}\right)\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 25771811432519.14:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\sqrt[3]{\sqrt[3]{\left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \left(\left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right)\right)} \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}}\right), \left(-b\right)\right)}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\left(\sqrt[3]{\frac{\frac{-3}{2} \cdot c}{b}} \cdot \sqrt[3]{\frac{1}{3}}\right) \cdot \left(\sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}} \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}}\right)\\

\end{array}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r15659557 = b;
        double r15659558 = -r15659557;
        double r15659559 = r15659557 * r15659557;
        double r15659560 = 3.0;
        double r15659561 = a;
        double r15659562 = r15659560 * r15659561;
        double r15659563 = c;
        double r15659564 = r15659562 * r15659563;
        double r15659565 = r15659559 - r15659564;
        double r15659566 = sqrt(r15659565);
        double r15659567 = r15659558 + r15659566;
        double r15659568 = r15659567 / r15659562;
        return r15659568;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r15659569 = b;
        double r15659570 = 25771811432519.14;
        bool r15659571 = r15659569 <= r15659570;
        double r15659572 = -3.0;
        double r15659573 = c;
        double r15659574 = a;
        double r15659575 = r15659573 * r15659574;
        double r15659576 = r15659569 * r15659569;
        double r15659577 = fma(r15659572, r15659575, r15659576);
        double r15659578 = sqrt(r15659577);
        double r15659579 = sqrt(r15659578);
        double r15659580 = r15659577 * r15659577;
        double r15659581 = r15659580 * r15659580;
        double r15659582 = r15659580 * r15659581;
        double r15659583 = cbrt(r15659582);
        double r15659584 = r15659583 * r15659577;
        double r15659585 = cbrt(r15659584);
        double r15659586 = sqrt(r15659585);
        double r15659587 = sqrt(r15659586);
        double r15659588 = -r15659569;
        double r15659589 = fma(r15659579, r15659587, r15659588);
        double r15659590 = 3.0;
        double r15659591 = r15659574 * r15659590;
        double r15659592 = r15659589 / r15659591;
        double r15659593 = -1.5;
        double r15659594 = r15659593 * r15659573;
        double r15659595 = r15659594 / r15659569;
        double r15659596 = cbrt(r15659595);
        double r15659597 = 0.3333333333333333;
        double r15659598 = cbrt(r15659597);
        double r15659599 = r15659596 * r15659598;
        double r15659600 = fma(r15659579, r15659579, r15659588);
        double r15659601 = r15659600 / r15659591;
        double r15659602 = cbrt(r15659601);
        double r15659603 = r15659602 * r15659602;
        double r15659604 = r15659599 * r15659603;
        double r15659605 = r15659571 ? r15659592 : r15659604;
        return r15659605;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Derivation

  1. Split input into 2 regimes
  2. if b < 25771811432519.14

    1. Initial program 46.2

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified46.2

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt46.2

      \[\leadsto \frac{\sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}} - b}{3 \cdot a}\]
    5. Applied sqrt-prod46.2

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}} - b}{3 \cdot a}\]
    6. Applied fma-neg45.7

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}}{3 \cdot a}\]
    7. Using strategy rm
    8. Applied add-cbrt-cube45.6

      \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\color{blue}{\sqrt[3]{\left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}}}\right), \left(-b\right)\right)}{3 \cdot a}\]
    9. Using strategy rm
    10. Applied add-cbrt-cube45.7

      \[\leadsto \frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\sqrt[3]{\color{blue}{\sqrt[3]{\left(\left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right)\right) \cdot \left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right)}} \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}}\right), \left(-b\right)\right)}{3 \cdot a}\]

    if 25771811432519.14 < b

    1. Initial program 57.7

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified57.7

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied add-sqr-sqrt57.7

      \[\leadsto \frac{\sqrt{\color{blue}{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}} - b}{3 \cdot a}\]
    5. Applied sqrt-prod57.3

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}} - b}{3 \cdot a}\]
    6. Applied fma-neg56.8

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}}{3 \cdot a}\]
    7. Using strategy rm
    8. Applied add-cube-cbrt56.8

      \[\leadsto \color{blue}{\left(\sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}} \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}}\right) \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}}}\]
    9. Taylor expanded around 0 63.5

      \[\leadsto \left(\sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}} \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}}\right) \cdot \color{blue}{\left(\sqrt[3]{\frac{1}{3}} \cdot e^{\frac{1}{3} \cdot \left(\left(\log c + \log \frac{-3}{2}\right) - \log b\right)}\right)}\]
    10. Simplified55.5

      \[\leadsto \left(\sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}} \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{3 \cdot a}}\right) \cdot \color{blue}{\left(\sqrt[3]{\frac{\frac{-3}{2} \cdot c}{b}} \cdot \sqrt[3]{\frac{1}{3}}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification51.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 25771811432519.14:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\sqrt[3]{\sqrt[3]{\left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \left(\left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right) \cdot \left(\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right) \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)\right)\right)} \cdot \mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}}\right), \left(-b\right)\right)}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\left(\sqrt[3]{\frac{\frac{-3}{2} \cdot c}{b}} \cdot \sqrt[3]{\frac{1}{3}}\right) \cdot \left(\sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}} \cdot \sqrt[3]{\frac{\mathsf{fma}\left(\left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(\sqrt{\sqrt{\mathsf{fma}\left(-3, \left(c \cdot a\right), \left(b \cdot b\right)\right)}}\right), \left(-b\right)\right)}{a \cdot 3}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019121 +o rules:numerics
(FPCore (a b c d)
  :name "Cubic critical, wide range"
  :pre (and (< 4.930380657631324e-32 a 2.028240960365167e+31) (< 4.930380657631324e-32 b 2.028240960365167e+31) (< 4.930380657631324e-32 c 2.028240960365167e+31))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))