Average Error: 28.3 → 16.7
Time: 20.3s
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 247.7224633917977314467862015590071678162:\\ \;\;\;\;\frac{\frac{\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 247.7224633917977314467862015590071678162:\\
\;\;\;\;\frac{\frac{\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 r6938817 = b;
        double r6938818 = -r6938817;
        double r6938819 = r6938817 * r6938817;
        double r6938820 = 3.0;
        double r6938821 = a;
        double r6938822 = r6938820 * r6938821;
        double r6938823 = c;
        double r6938824 = r6938822 * r6938823;
        double r6938825 = r6938819 - r6938824;
        double r6938826 = sqrt(r6938825);
        double r6938827 = r6938818 + r6938826;
        double r6938828 = r6938827 / r6938822;
        return r6938828;
}

double f(double a, double b, double c) {
        double r6938829 = b;
        double r6938830 = 247.72246339179773;
        bool r6938831 = r6938829 <= r6938830;
        double r6938832 = r6938829 * r6938829;
        double r6938833 = 3.0;
        double r6938834 = a;
        double r6938835 = r6938833 * r6938834;
        double r6938836 = c;
        double r6938837 = r6938835 * r6938836;
        double r6938838 = r6938832 - r6938837;
        double r6938839 = sqrt(r6938838);
        double r6938840 = r6938839 - r6938829;
        double r6938841 = r6938840 / r6938833;
        double r6938842 = r6938841 / r6938834;
        double r6938843 = -0.5;
        double r6938844 = r6938836 / r6938829;
        double r6938845 = r6938843 * r6938844;
        double r6938846 = r6938831 ? r6938842 : r6938845;
        return r6938846;
}

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

    1. Initial program 15.9

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

      \[\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 associate-/r*15.9

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

    if 247.72246339179773 < b

    1. Initial program 35.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 247.7224633917977314467862015590071678162:\\ \;\;\;\;\frac{\frac{\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 2019173 
(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.0 a) c)))) (* 3.0 a)))