Average Error: 28.6 → 16.2
Time: 7.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 3187.18097597923543:\\ \;\;\;\;\frac{\frac{\left({b}^{2} - 3 \cdot \left(a \cdot c\right)\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 3187.18097597923543:\\
\;\;\;\;\frac{\frac{\left({b}^{2} - 3 \cdot \left(a \cdot c\right)\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 r105001 = b;
        double r105002 = -r105001;
        double r105003 = r105001 * r105001;
        double r105004 = 3.0;
        double r105005 = a;
        double r105006 = r105004 * r105005;
        double r105007 = c;
        double r105008 = r105006 * r105007;
        double r105009 = r105003 - r105008;
        double r105010 = sqrt(r105009);
        double r105011 = r105002 + r105010;
        double r105012 = r105011 / r105006;
        return r105012;
}

double f(double a, double b, double c) {
        double r105013 = b;
        double r105014 = 3187.1809759792354;
        bool r105015 = r105013 <= r105014;
        double r105016 = 2.0;
        double r105017 = pow(r105013, r105016);
        double r105018 = 3.0;
        double r105019 = a;
        double r105020 = c;
        double r105021 = r105019 * r105020;
        double r105022 = r105018 * r105021;
        double r105023 = r105017 - r105022;
        double r105024 = r105023 - r105017;
        double r105025 = r105013 * r105013;
        double r105026 = r105018 * r105019;
        double r105027 = r105026 * r105020;
        double r105028 = r105025 - r105027;
        double r105029 = sqrt(r105028);
        double r105030 = r105029 + r105013;
        double r105031 = r105024 / r105030;
        double r105032 = r105031 / r105026;
        double r105033 = -0.5;
        double r105034 = r105020 / r105013;
        double r105035 = r105033 * r105034;
        double r105036 = r105015 ? r105032 : r105035;
        return r105036;
}

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

    1. Initial program 18.3

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

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

    if 3187.1809759792354 < b

    1. Initial program 37.4

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

      \[\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}{-0.5 \cdot \frac{c}{b}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification16.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 3187.18097597923543:\\ \;\;\;\;\frac{\frac{\left({b}^{2} - 3 \cdot \left(a \cdot c\right)\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 2020047 
(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)))