Average Error: 44.0 → 11.4
Time: 18.0s
Precision: 64
\[1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt a \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt b \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt c \lt 9007199254740992\]
\[\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 6.961131476357276728544534868600712762543 \cdot 10^{-8}:\\ \;\;\;\;\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}:\\ \;\;\;\;-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 6.961131476357276728544534868600712762543 \cdot 10^{-8}:\\
\;\;\;\;\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}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\

\end{array}
double f(double a, double b, double c) {
        double r4274006 = b;
        double r4274007 = -r4274006;
        double r4274008 = r4274006 * r4274006;
        double r4274009 = 3.0;
        double r4274010 = a;
        double r4274011 = r4274009 * r4274010;
        double r4274012 = c;
        double r4274013 = r4274011 * r4274012;
        double r4274014 = r4274008 - r4274013;
        double r4274015 = sqrt(r4274014);
        double r4274016 = r4274007 + r4274015;
        double r4274017 = r4274016 / r4274011;
        return r4274017;
}

double f(double a, double b, double c) {
        double r4274018 = b;
        double r4274019 = 6.961131476357277e-08;
        bool r4274020 = r4274018 <= r4274019;
        double r4274021 = r4274018 * r4274018;
        double r4274022 = c;
        double r4274023 = a;
        double r4274024 = 3.0;
        double r4274025 = r4274023 * r4274024;
        double r4274026 = r4274022 * r4274025;
        double r4274027 = r4274021 - r4274026;
        double r4274028 = sqrt(r4274027);
        double r4274029 = r4274027 * r4274028;
        double r4274030 = r4274021 * r4274018;
        double r4274031 = r4274029 - r4274030;
        double r4274032 = r4274018 * r4274028;
        double r4274033 = r4274032 + r4274021;
        double r4274034 = r4274027 + r4274033;
        double r4274035 = r4274031 / r4274034;
        double r4274036 = r4274035 / r4274025;
        double r4274037 = -0.5;
        double r4274038 = r4274022 / r4274018;
        double r4274039 = r4274037 * r4274038;
        double r4274040 = r4274020 ? r4274036 : r4274039;
        return r4274040;
}

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 < 6.961131476357277e-08

    1. Initial program 12.8

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

      \[\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--13.0

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

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

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

    if 6.961131476357277e-08 < b

    1. Initial program 44.8

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 6.961131476357276728544534868600712762543 \cdot 10^{-8}:\\ \;\;\;\;\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}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

herbie shell --seed 2019172 
(FPCore (a b c)
  :name "Cubic critical, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))