Average Error: 28.8 → 16.2
Time: 17.4s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\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 563.9094021205955:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right)}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{-1}{2} \cdot 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 563.9094021205955:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right)}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r5033907 = b;
        double r5033908 = -r5033907;
        double r5033909 = r5033907 * r5033907;
        double r5033910 = 3.0;
        double r5033911 = a;
        double r5033912 = r5033910 * r5033911;
        double r5033913 = c;
        double r5033914 = r5033912 * r5033913;
        double r5033915 = r5033909 - r5033914;
        double r5033916 = sqrt(r5033915);
        double r5033917 = r5033908 + r5033916;
        double r5033918 = r5033917 / r5033912;
        return r5033918;
}

double f(double a, double b, double c) {
        double r5033919 = b;
        double r5033920 = 563.9094021205955;
        bool r5033921 = r5033919 <= r5033920;
        double r5033922 = r5033919 * r5033919;
        double r5033923 = c;
        double r5033924 = 3.0;
        double r5033925 = a;
        double r5033926 = r5033924 * r5033925;
        double r5033927 = r5033923 * r5033926;
        double r5033928 = r5033922 - r5033927;
        double r5033929 = sqrt(r5033928);
        double r5033930 = r5033928 * r5033929;
        double r5033931 = r5033922 * r5033919;
        double r5033932 = r5033930 - r5033931;
        double r5033933 = r5033919 * r5033929;
        double r5033934 = r5033933 + r5033922;
        double r5033935 = r5033928 + r5033934;
        double r5033936 = r5033932 / r5033935;
        double r5033937 = r5033936 / r5033926;
        double r5033938 = -0.5;
        double r5033939 = r5033938 * r5033923;
        double r5033940 = r5033939 / r5033919;
        double r5033941 = r5033921 ? r5033937 : r5033940;
        return r5033941;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

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

    1. Initial program 16.8

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

      \[\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--16.8

      \[\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. Simplified16.1

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} \cdot \left(b \cdot b - \left(3 \cdot a\right) \cdot c\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. Simplified16.1

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

    if 563.9094021205955 < b

    1. Initial program 36.3

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

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied associate-/r*16.4

      \[\leadsto \color{blue}{\frac{\frac{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}{3}}{a}}\]
    6. Simplified16.4

      \[\leadsto \frac{\color{blue}{\left(c \cdot \frac{-1}{2}\right) \cdot \frac{a}{b}}}{a}\]
    7. Using strategy rm
    8. Applied associate-/l*16.3

      \[\leadsto \color{blue}{\frac{c \cdot \frac{-1}{2}}{\frac{a}{\frac{a}{b}}}}\]
    9. Simplified16.3

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

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

Reproduce

herbie shell --seed 2019163 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3 a) c)))) (* 3 a)))