Average Error: 44.0 → 11.2
Time: 30.3s
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\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.12005985553413497:\\ \;\;\;\;\frac{\frac{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\ \mathbf{else}:\\ \;\;\;\;\frac{-1}{2} \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.12005985553413497:\\
\;\;\;\;\frac{\frac{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + -3 \cdot \left(a \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + -3 \cdot \left(a \cdot c\right)} + b \cdot b\right)}}{a \cdot 3}\\

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

\end{array}
double f(double a, double b, double c) {
        double r3547504 = b;
        double r3547505 = -r3547504;
        double r3547506 = r3547504 * r3547504;
        double r3547507 = 3.0;
        double r3547508 = a;
        double r3547509 = r3547507 * r3547508;
        double r3547510 = c;
        double r3547511 = r3547509 * r3547510;
        double r3547512 = r3547506 - r3547511;
        double r3547513 = sqrt(r3547512);
        double r3547514 = r3547505 + r3547513;
        double r3547515 = r3547514 / r3547509;
        return r3547515;
}

double f(double a, double b, double c) {
        double r3547516 = b;
        double r3547517 = 0.12005985553413497;
        bool r3547518 = r3547516 <= r3547517;
        double r3547519 = r3547516 * r3547516;
        double r3547520 = -3.0;
        double r3547521 = a;
        double r3547522 = c;
        double r3547523 = r3547521 * r3547522;
        double r3547524 = r3547520 * r3547523;
        double r3547525 = r3547519 + r3547524;
        double r3547526 = sqrt(r3547525);
        double r3547527 = r3547525 * r3547526;
        double r3547528 = r3547519 * r3547516;
        double r3547529 = r3547527 - r3547528;
        double r3547530 = r3547516 * r3547526;
        double r3547531 = r3547530 + r3547519;
        double r3547532 = r3547525 + r3547531;
        double r3547533 = r3547529 / r3547532;
        double r3547534 = 3.0;
        double r3547535 = r3547521 * r3547534;
        double r3547536 = r3547533 / r3547535;
        double r3547537 = -0.5;
        double r3547538 = r3547522 / r3547516;
        double r3547539 = r3547537 * r3547538;
        double r3547540 = r3547518 ? r3547536 : r3547539;
        return r3547540;
}

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.12005985553413497

    1. Initial program 23.2

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

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

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

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

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

    if 0.12005985553413497 < b

    1. Initial program 47.3

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

      \[\leadsto \color{blue}{\frac{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}{3 \cdot a}}\]
    3. Taylor expanded around inf 9.4

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

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

Reproduce

herbie shell --seed 2019146 
(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 a) c)))) (* 3 a)))