Average Error: 28.6 → 16.5
Time: 18.9s
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 3260.8737586103744:\\ \;\;\;\;\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 3260.8737586103744:\\
\;\;\;\;\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 r3534966 = b;
        double r3534967 = -r3534966;
        double r3534968 = r3534966 * r3534966;
        double r3534969 = 3.0;
        double r3534970 = a;
        double r3534971 = r3534969 * r3534970;
        double r3534972 = c;
        double r3534973 = r3534971 * r3534972;
        double r3534974 = r3534968 - r3534973;
        double r3534975 = sqrt(r3534974);
        double r3534976 = r3534967 + r3534975;
        double r3534977 = r3534976 / r3534971;
        return r3534977;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r3534978 = b;
        double r3534979 = 3260.8737586103744;
        bool r3534980 = r3534978 <= r3534979;
        double r3534981 = r3534978 * r3534978;
        double r3534982 = 3.0;
        double r3534983 = c;
        double r3534984 = r3534982 * r3534983;
        double r3534985 = a;
        double r3534986 = r3534984 * r3534985;
        double r3534987 = r3534981 - r3534986;
        double r3534988 = sqrt(r3534987);
        double r3534989 = r3534987 * r3534988;
        double r3534990 = r3534981 * r3534978;
        double r3534991 = r3534989 - r3534990;
        double r3534992 = r3534978 * r3534988;
        double r3534993 = r3534992 + r3534981;
        double r3534994 = r3534987 + r3534993;
        double r3534995 = r3534991 / r3534994;
        double r3534996 = r3534985 * r3534982;
        double r3534997 = r3534995 / r3534996;
        double r3534998 = -0.5;
        double r3534999 = r3534983 / r3534978;
        double r3535000 = r3534998 * r3534999;
        double r3535001 = r3534980 ? r3534997 : r3535000;
        return r3535001;
}

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 < 3260.8737586103744

    1. Initial program 18.4

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

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

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

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

      \[\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 3260.8737586103744 < b

    1. Initial program 37.3

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified37.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 15.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 3260.8737586103744:\\ \;\;\;\;\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 2019130 
(FPCore (a b c d)
  :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)))