Average Error: 44.1 → 11.0
Time: 19.0s
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\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 0.015569414508954786:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) + \left(b \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \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 0.015569414508954786:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) + \left(b \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} + b \cdot b\right)}}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\

\end{array}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r2842616 = b;
        double r2842617 = -r2842616;
        double r2842618 = r2842616 * r2842616;
        double r2842619 = 3.0;
        double r2842620 = a;
        double r2842621 = r2842619 * r2842620;
        double r2842622 = c;
        double r2842623 = r2842621 * r2842622;
        double r2842624 = r2842618 - r2842623;
        double r2842625 = sqrt(r2842624);
        double r2842626 = r2842617 + r2842625;
        double r2842627 = r2842626 / r2842621;
        return r2842627;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r2842628 = b;
        double r2842629 = 0.015569414508954786;
        bool r2842630 = r2842628 <= r2842629;
        double r2842631 = r2842628 * r2842628;
        double r2842632 = 3.0;
        double r2842633 = c;
        double r2842634 = r2842632 * r2842633;
        double r2842635 = a;
        double r2842636 = r2842634 * r2842635;
        double r2842637 = r2842631 - r2842636;
        double r2842638 = sqrt(r2842637);
        double r2842639 = r2842637 * r2842638;
        double r2842640 = r2842631 * r2842628;
        double r2842641 = r2842639 - r2842640;
        double r2842642 = r2842628 * r2842638;
        double r2842643 = r2842642 + r2842631;
        double r2842644 = r2842637 + r2842643;
        double r2842645 = r2842641 / r2842644;
        double r2842646 = r2842635 * r2842632;
        double r2842647 = r2842645 / r2842646;
        double r2842648 = -0.5;
        double r2842649 = r2842633 / r2842628;
        double r2842650 = r2842648 * r2842649;
        double r2842651 = r2842630 ? r2842647 : r2842650;
        return r2842651;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 22.0

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
    3. Using strategy rm
    4. Applied flip3--22.1

      \[\leadsto \frac{\color{blue}{\frac{{\left(\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}\right)}^{3} - {b}^{3}}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \left(b \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot b\right)}}}{3 \cdot a}\]
    5. Simplified21.3

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{b \cdot b - a \cdot \left(3 \cdot c\right)} \cdot \left(b \cdot b - a \cdot \left(3 \cdot c\right)\right) - \left(b \cdot b\right) \cdot b}}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + \left(b \cdot b + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot b\right)}}{3 \cdot a}\]
    6. Simplified21.3

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

    if 0.015569414508954786 < b

    1. Initial program 46.8

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
    3. Taylor expanded around inf 9.7

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification11.0

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

Reproduce

herbie shell --seed 2019134 
(FPCore (a b c d)
  :name "Cubic critical, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))