Average Error: 28.8 → 16.3
Time: 1.1m
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 1059.10621853732:\\ \;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{3 \cdot a}{\frac{c}{b} \cdot \left(a \cdot \frac{-3}{2}\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 1059.10621853732:\\
\;\;\;\;\frac{\left(b \cdot b - c \cdot \left(3 \cdot a\right)\right) \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} - \left(b \cdot b\right) \cdot b}{\left(3 \cdot a\right) \cdot \left(\left(b \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} + b \cdot b\right) + \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)} \cdot \sqrt{b \cdot b - c \cdot \left(3 \cdot a\right)}\right)}\\

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

\end{array}
double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r17211899 = b;
        double r17211900 = -r17211899;
        double r17211901 = r17211899 * r17211899;
        double r17211902 = 3.0;
        double r17211903 = a;
        double r17211904 = r17211902 * r17211903;
        double r17211905 = c;
        double r17211906 = r17211904 * r17211905;
        double r17211907 = r17211901 - r17211906;
        double r17211908 = sqrt(r17211907);
        double r17211909 = r17211900 + r17211908;
        double r17211910 = r17211909 / r17211904;
        return r17211910;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r17211911 = b;
        double r17211912 = 1059.10621853732;
        bool r17211913 = r17211911 <= r17211912;
        double r17211914 = r17211911 * r17211911;
        double r17211915 = c;
        double r17211916 = 3.0;
        double r17211917 = a;
        double r17211918 = r17211916 * r17211917;
        double r17211919 = r17211915 * r17211918;
        double r17211920 = r17211914 - r17211919;
        double r17211921 = sqrt(r17211920);
        double r17211922 = r17211920 * r17211921;
        double r17211923 = r17211914 * r17211911;
        double r17211924 = r17211922 - r17211923;
        double r17211925 = r17211911 * r17211921;
        double r17211926 = r17211925 + r17211914;
        double r17211927 = r17211921 * r17211921;
        double r17211928 = r17211926 + r17211927;
        double r17211929 = r17211918 * r17211928;
        double r17211930 = r17211924 / r17211929;
        double r17211931 = 1.0;
        double r17211932 = r17211915 / r17211911;
        double r17211933 = -1.5;
        double r17211934 = r17211917 * r17211933;
        double r17211935 = r17211932 * r17211934;
        double r17211936 = r17211918 / r17211935;
        double r17211937 = r17211931 / r17211936;
        double r17211938 = r17211913 ? r17211930 : r17211937;
        return r17211938;
}

Error

Bits error versus a

Bits error versus b

Bits error versus c

Bits error versus d

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if b < 1059.10621853732

    1. Initial program 17.5

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}\]
    2. Simplified17.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--17.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. Applied associate-/l/17.6

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

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

    if 1059.10621853732 < b

    1. Initial program 36.8

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

      \[\leadsto \frac{\color{blue}{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}}{3 \cdot a}\]
    4. Using strategy rm
    5. Applied clear-num16.0

      \[\leadsto \color{blue}{\frac{1}{\frac{3 \cdot a}{\frac{-3}{2} \cdot \frac{a \cdot c}{b}}}}\]
    6. Using strategy rm
    7. Applied *-un-lft-identity16.0

      \[\leadsto \frac{1}{\frac{3 \cdot a}{\frac{-3}{2} \cdot \frac{a \cdot c}{\color{blue}{1 \cdot b}}}}\]
    8. Applied times-frac16.0

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

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

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

Reproduce

herbie shell --seed 2019119 
(FPCore (a b c d)
  :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)))