Average Error: 28.2 → 16.5
Time: 19.0s
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 208.2161789220425021085247863084077835083:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - a \cdot \left(c \cdot 3\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(c \cdot 3\right)\right) + b \cdot \left(b + \sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)}\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{a \cdot 3} \cdot \left(\left(-1.5 \cdot a\right) \cdot \frac{c}{b}\right)\\ \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 208.2161789220425021085247863084077835083:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - a \cdot \left(c \cdot 3\right)\right) \cdot \sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - a \cdot \left(c \cdot 3\right)\right) + b \cdot \left(b + \sqrt{b \cdot b - a \cdot \left(c \cdot 3\right)}\right)}}{a \cdot 3}\\

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

\end{array}
double f(double a, double b, double c) {
        double r4051844 = b;
        double r4051845 = -r4051844;
        double r4051846 = r4051844 * r4051844;
        double r4051847 = 3.0;
        double r4051848 = a;
        double r4051849 = r4051847 * r4051848;
        double r4051850 = c;
        double r4051851 = r4051849 * r4051850;
        double r4051852 = r4051846 - r4051851;
        double r4051853 = sqrt(r4051852);
        double r4051854 = r4051845 + r4051853;
        double r4051855 = r4051854 / r4051849;
        return r4051855;
}

double f(double a, double b, double c) {
        double r4051856 = b;
        double r4051857 = 208.2161789220425;
        bool r4051858 = r4051856 <= r4051857;
        double r4051859 = r4051856 * r4051856;
        double r4051860 = a;
        double r4051861 = c;
        double r4051862 = 3.0;
        double r4051863 = r4051861 * r4051862;
        double r4051864 = r4051860 * r4051863;
        double r4051865 = r4051859 - r4051864;
        double r4051866 = sqrt(r4051865);
        double r4051867 = r4051865 * r4051866;
        double r4051868 = r4051859 * r4051856;
        double r4051869 = r4051867 - r4051868;
        double r4051870 = r4051856 + r4051866;
        double r4051871 = r4051856 * r4051870;
        double r4051872 = r4051865 + r4051871;
        double r4051873 = r4051869 / r4051872;
        double r4051874 = r4051860 * r4051862;
        double r4051875 = r4051873 / r4051874;
        double r4051876 = 1.0;
        double r4051877 = r4051876 / r4051874;
        double r4051878 = -1.5;
        double r4051879 = r4051878 * r4051860;
        double r4051880 = r4051861 / r4051856;
        double r4051881 = r4051879 * r4051880;
        double r4051882 = r4051877 * r4051881;
        double r4051883 = r4051858 ? r4051875 : r4051882;
        return r4051883;
}

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

    1. Initial program 15.5

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

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

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

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

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

    if 208.2161789220425 < b

    1. Initial program 34.9

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\left(-1.5 \cdot a\right)} \cdot \frac{c}{b}}{3 \cdot a}\]
    9. Using strategy rm
    10. Applied div-inv17.4

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

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

Reproduce

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