Average Error: 44.2 → 11.1
Time: 15.7s
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.04224730280532443:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) + \left(b \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} + 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.04224730280532443:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b - \left(3 \cdot c\right) \cdot a\right) + \left(b \cdot \sqrt{b \cdot b - \left(3 \cdot c\right) \cdot a} + 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 __attribute__((unused)) d) {
        double r3243477 = b;
        double r3243478 = -r3243477;
        double r3243479 = r3243477 * r3243477;
        double r3243480 = 3.0;
        double r3243481 = a;
        double r3243482 = r3243480 * r3243481;
        double r3243483 = c;
        double r3243484 = r3243482 * r3243483;
        double r3243485 = r3243479 - r3243484;
        double r3243486 = sqrt(r3243485);
        double r3243487 = r3243478 + r3243486;
        double r3243488 = r3243487 / r3243482;
        return r3243488;
}

double f(double a, double b, double c, double __attribute__((unused)) d) {
        double r3243489 = b;
        double r3243490 = 0.04224730280532443;
        bool r3243491 = r3243489 <= r3243490;
        double r3243492 = r3243489 * r3243489;
        double r3243493 = 3.0;
        double r3243494 = c;
        double r3243495 = r3243493 * r3243494;
        double r3243496 = a;
        double r3243497 = r3243495 * r3243496;
        double r3243498 = r3243492 - r3243497;
        double r3243499 = sqrt(r3243498);
        double r3243500 = r3243498 * r3243499;
        double r3243501 = r3243492 * r3243489;
        double r3243502 = r3243500 - r3243501;
        double r3243503 = r3243489 * r3243499;
        double r3243504 = r3243503 + r3243492;
        double r3243505 = r3243498 + r3243504;
        double r3243506 = r3243502 / r3243505;
        double r3243507 = r3243496 * r3243493;
        double r3243508 = r3243506 / r3243507;
        double r3243509 = -0.5;
        double r3243510 = r3243494 / r3243489;
        double r3243511 = r3243509 * r3243510;
        double r3243512 = r3243491 ? r3243508 : r3243511;
        return r3243512;
}

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

    1. Initial program 22.8

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

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

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

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

    if 0.04224730280532443 < b

    1. Initial program 47.2

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

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

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

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

Reproduce

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