Average Error: 28.6 → 16.3
Time: 8.4s
Precision: 64
\[1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt a \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt b \lt 94906265.62425155937671661376953125 \land 1.053671212772350866701172186984739043147 \cdot 10^{-8} \lt c \lt 94906265.62425155937671661376953125\]
\[\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 648.3375935627877879596780985593795776367:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3}}{a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \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 648.3375935627877879596780985593795776367:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - b \cdot b}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r84908 = b;
        double r84909 = -r84908;
        double r84910 = r84908 * r84908;
        double r84911 = 3.0;
        double r84912 = a;
        double r84913 = r84911 * r84912;
        double r84914 = c;
        double r84915 = r84913 * r84914;
        double r84916 = r84910 - r84915;
        double r84917 = sqrt(r84916);
        double r84918 = r84909 + r84917;
        double r84919 = r84918 / r84913;
        return r84919;
}

double f(double a, double b, double c) {
        double r84920 = b;
        double r84921 = 648.3375935627878;
        bool r84922 = r84920 <= r84921;
        double r84923 = r84920 * r84920;
        double r84924 = 3.0;
        double r84925 = a;
        double r84926 = r84924 * r84925;
        double r84927 = c;
        double r84928 = r84926 * r84927;
        double r84929 = r84923 - r84928;
        double r84930 = r84929 - r84923;
        double r84931 = sqrt(r84929);
        double r84932 = r84931 + r84920;
        double r84933 = r84930 / r84932;
        double r84934 = r84933 / r84924;
        double r84935 = r84934 / r84925;
        double r84936 = -0.5;
        double r84937 = r84927 / r84920;
        double r84938 = r84936 * r84937;
        double r84939 = r84922 ? r84935 : r84938;
        return r84939;
}

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

    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{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3}}{a}}\]
    3. Using strategy rm
    4. Applied flip--16.8

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

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

    if 648.3375935627878 < b

    1. Initial program 35.8

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

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

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

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

Reproduce

herbie shell --seed 2019350 
(FPCore (a b c)
  :name "Cubic critical, narrow range"
  :precision binary64
  :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)))