Average Error: 28.8 → 16.6
Time: 17.2s
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 77.85350311081474217189679620787501335144:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(a \cdot -1.5\right) \cdot \frac{c}{b}}{a \cdot 3}\\ \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 77.85350311081474217189679620787501335144:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - c \cdot \left(a \cdot 3\right)\right) + \left(b \cdot \sqrt{b \cdot b - c \cdot \left(a \cdot 3\right)} + b \cdot b\right)}}{a \cdot 3}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(a \cdot -1.5\right) \cdot \frac{c}{b}}{a \cdot 3}\\

\end{array}
double f(double a, double b, double c) {
        double r4015093 = b;
        double r4015094 = -r4015093;
        double r4015095 = r4015093 * r4015093;
        double r4015096 = 3.0;
        double r4015097 = a;
        double r4015098 = r4015096 * r4015097;
        double r4015099 = c;
        double r4015100 = r4015098 * r4015099;
        double r4015101 = r4015095 - r4015100;
        double r4015102 = sqrt(r4015101);
        double r4015103 = r4015094 + r4015102;
        double r4015104 = r4015103 / r4015098;
        return r4015104;
}

double f(double a, double b, double c) {
        double r4015105 = b;
        double r4015106 = 77.85350311081474;
        bool r4015107 = r4015105 <= r4015106;
        double r4015108 = r4015105 * r4015105;
        double r4015109 = c;
        double r4015110 = a;
        double r4015111 = 3.0;
        double r4015112 = r4015110 * r4015111;
        double r4015113 = r4015109 * r4015112;
        double r4015114 = r4015108 - r4015113;
        double r4015115 = sqrt(r4015114);
        double r4015116 = r4015114 * r4015115;
        double r4015117 = r4015108 * r4015105;
        double r4015118 = r4015116 - r4015117;
        double r4015119 = r4015105 * r4015115;
        double r4015120 = r4015119 + r4015108;
        double r4015121 = r4015114 + r4015120;
        double r4015122 = r4015118 / r4015121;
        double r4015123 = r4015122 / r4015112;
        double r4015124 = -1.5;
        double r4015125 = r4015110 * r4015124;
        double r4015126 = r4015109 / r4015105;
        double r4015127 = r4015125 * r4015126;
        double r4015128 = r4015127 / r4015112;
        double r4015129 = r4015107 ? r4015123 : r4015128;
        return r4015129;
}

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

    1. Initial program 15.1

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

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

      \[\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. Simplified14.5

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

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

    if 77.85350311081474 < b

    1. Initial program 34.8

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(a \cdot -1.5\right)} \cdot \frac{c}{b}}{3 \cdot a}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification16.6

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

Reproduce

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