Average Error: 29.0 → 16.3
Time: 6.1s
Precision: 64
\[1.05367121277235087 \cdot 10^{-8} \lt a \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt b \lt 94906265.6242515594 \land 1.05367121277235087 \cdot 10^{-8} \lt c \lt 94906265.6242515594\]
\[\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 228.26278739030357:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - {b}^{2}}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3 \cdot 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 228.26278739030357:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - {b}^{2}}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r11899 = b;
        double r11900 = -r11899;
        double r11901 = r11899 * r11899;
        double r11902 = 3.0;
        double r11903 = a;
        double r11904 = r11902 * r11903;
        double r11905 = c;
        double r11906 = r11904 * r11905;
        double r11907 = r11901 - r11906;
        double r11908 = sqrt(r11907);
        double r11909 = r11900 + r11908;
        double r11910 = r11909 / r11904;
        return r11910;
}

double f(double a, double b, double c) {
        double r11911 = b;
        double r11912 = 228.26278739030357;
        bool r11913 = r11911 <= r11912;
        double r11914 = r11911 * r11911;
        double r11915 = 3.0;
        double r11916 = a;
        double r11917 = r11915 * r11916;
        double r11918 = c;
        double r11919 = r11917 * r11918;
        double r11920 = r11914 - r11919;
        double r11921 = 2.0;
        double r11922 = pow(r11911, r11921);
        double r11923 = r11920 - r11922;
        double r11924 = sqrt(r11920);
        double r11925 = r11924 + r11911;
        double r11926 = r11923 / r11925;
        double r11927 = r11926 / r11917;
        double r11928 = -0.5;
        double r11929 = r11918 / r11911;
        double r11930 = r11928 * r11929;
        double r11931 = r11913 ? r11927 : r11930;
        return r11931;
}

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

    1. Initial program 16.3

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

      \[\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 flip--16.3

      \[\leadsto \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 \cdot a}\]
    5. Simplified15.3

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

    if 228.26278739030357 < b

    1. Initial program 35.6

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

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

      \[\leadsto \frac{\color{blue}{-1.5 \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity16.9

      \[\leadsto \frac{-1.5 \cdot \frac{a \cdot c}{\color{blue}{1 \cdot b}}}{3 \cdot a}\]
    6. Applied times-frac16.8

      \[\leadsto \frac{-1.5 \cdot \color{blue}{\left(\frac{a}{1} \cdot \frac{c}{b}\right)}}{3 \cdot a}\]
    7. Applied associate-*r*16.8

      \[\leadsto \frac{\color{blue}{\left(-1.5 \cdot \frac{a}{1}\right) \cdot \frac{c}{b}}}{3 \cdot a}\]
    8. Simplified16.8

      \[\leadsto \frac{\color{blue}{\left(-1.5 \cdot a\right)} \cdot \frac{c}{b}}{3 \cdot a}\]
    9. Taylor expanded around 0 16.8

      \[\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 228.26278739030357:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot a\right) \cdot c\right) - {b}^{2}}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} + b}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2020045 
(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)))