Average Error: 28.6 → 17.1
Time: 22.8s
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 83.70631561304585:\\ \;\;\;\;\frac{\frac{\left(\left(-3 \cdot a\right) \cdot c + b \cdot b\right) \cdot \sqrt{\left(-3 \cdot a\right) \cdot c + b \cdot b} - b \cdot \left(b \cdot b\right)}{\left(\left(-3 \cdot a\right) \cdot c + b \cdot b\right) + \left(b \cdot b + b \cdot \sqrt{\left(-3 \cdot a\right) \cdot c + 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 83.70631561304585:\\
\;\;\;\;\frac{\frac{\left(\left(-3 \cdot a\right) \cdot c + b \cdot b\right) \cdot \sqrt{\left(-3 \cdot a\right) \cdot c + b \cdot b} - b \cdot \left(b \cdot b\right)}{\left(\left(-3 \cdot a\right) \cdot c + b \cdot b\right) + \left(b \cdot b + b \cdot \sqrt{\left(-3 \cdot a\right) \cdot c + 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 r1647127 = b;
        double r1647128 = -r1647127;
        double r1647129 = r1647127 * r1647127;
        double r1647130 = 3.0;
        double r1647131 = a;
        double r1647132 = r1647130 * r1647131;
        double r1647133 = c;
        double r1647134 = r1647132 * r1647133;
        double r1647135 = r1647129 - r1647134;
        double r1647136 = sqrt(r1647135);
        double r1647137 = r1647128 + r1647136;
        double r1647138 = r1647137 / r1647132;
        return r1647138;
}

double f(double a, double b, double c) {
        double r1647139 = b;
        double r1647140 = 83.70631561304585;
        bool r1647141 = r1647139 <= r1647140;
        double r1647142 = -3.0;
        double r1647143 = a;
        double r1647144 = r1647142 * r1647143;
        double r1647145 = c;
        double r1647146 = r1647144 * r1647145;
        double r1647147 = r1647139 * r1647139;
        double r1647148 = r1647146 + r1647147;
        double r1647149 = sqrt(r1647148);
        double r1647150 = r1647148 * r1647149;
        double r1647151 = r1647139 * r1647147;
        double r1647152 = r1647150 - r1647151;
        double r1647153 = r1647139 * r1647149;
        double r1647154 = r1647147 + r1647153;
        double r1647155 = r1647148 + r1647154;
        double r1647156 = r1647152 / r1647155;
        double r1647157 = 3.0;
        double r1647158 = r1647143 * r1647157;
        double r1647159 = r1647156 / r1647158;
        double r1647160 = -0.5;
        double r1647161 = r1647145 / r1647139;
        double r1647162 = r1647160 * r1647161;
        double r1647163 = r1647141 ? r1647159 : r1647162;
        return r1647163;
}

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

    1. Initial program 15.7

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

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

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

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

    if 83.70631561304585 < b

    1. Initial program 34.2

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

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

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

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

Reproduce

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