Average Error: 43.5 → 11.4
Time: 33.9s
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 0.00125353222550368486286342939450833000592:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(a \cdot c\right) \cdot 3\right) \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - \left(b \cdot b\right) \cdot b}{\left(b \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} + \left(b \cdot b - \left(a \cdot c\right) \cdot 3\right)\right) + b \cdot b}}{3 \cdot 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 0.00125353222550368486286342939450833000592:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(a \cdot c\right) \cdot 3\right) \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - \left(b \cdot b\right) \cdot b}{\left(b \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} + \left(b \cdot b - \left(a \cdot c\right) \cdot 3\right)\right) + b \cdot b}}{3 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \frac{c}{b}\\

\end{array}
double f(double a, double b, double c) {
        double r5227434 = b;
        double r5227435 = -r5227434;
        double r5227436 = r5227434 * r5227434;
        double r5227437 = 3.0;
        double r5227438 = a;
        double r5227439 = r5227437 * r5227438;
        double r5227440 = c;
        double r5227441 = r5227439 * r5227440;
        double r5227442 = r5227436 - r5227441;
        double r5227443 = sqrt(r5227442);
        double r5227444 = r5227435 + r5227443;
        double r5227445 = r5227444 / r5227439;
        return r5227445;
}

double f(double a, double b, double c) {
        double r5227446 = b;
        double r5227447 = 0.0012535322255036849;
        bool r5227448 = r5227446 <= r5227447;
        double r5227449 = r5227446 * r5227446;
        double r5227450 = a;
        double r5227451 = c;
        double r5227452 = r5227450 * r5227451;
        double r5227453 = 3.0;
        double r5227454 = r5227452 * r5227453;
        double r5227455 = r5227449 - r5227454;
        double r5227456 = sqrt(r5227455);
        double r5227457 = r5227455 * r5227456;
        double r5227458 = r5227449 * r5227446;
        double r5227459 = r5227457 - r5227458;
        double r5227460 = r5227446 * r5227456;
        double r5227461 = r5227460 + r5227455;
        double r5227462 = r5227461 + r5227449;
        double r5227463 = r5227459 / r5227462;
        double r5227464 = r5227453 * r5227450;
        double r5227465 = r5227463 / r5227464;
        double r5227466 = -0.5;
        double r5227467 = r5227451 / r5227446;
        double r5227468 = r5227466 * r5227467;
        double r5227469 = r5227448 ? r5227465 : r5227468;
        return r5227469;
}

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

    1. Initial program 20.3

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

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

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

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

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

    if 0.0012535322255036849 < b

    1. Initial program 45.8

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

      \[\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 0.00125353222550368486286342939450833000592:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(a \cdot c\right) \cdot 3\right) \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} - \left(b \cdot b\right) \cdot b}{\left(b \cdot \sqrt{b \cdot b - \left(a \cdot c\right) \cdot 3} + \left(b \cdot b - \left(a \cdot c\right) \cdot 3\right)\right) + b \cdot b}}{3 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;-0.5 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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