Average Error: 9.4 → 5.8
Time: 14.9s
Precision: 64
\[\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 60632211102564358878658560:\\ \;\;\;\;\frac{\left(-b\right) + \left(\sqrt[3]{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{a \cdot c}{b}}{2 \cdot a}\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 60632211102564358878658560:\\
\;\;\;\;\frac{\left(-b\right) + \left(\sqrt[3]{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}} \cdot \sqrt[3]{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}\right) \cdot \sqrt[3]{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}}{2 \cdot a}\\

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

\end{array}
double f(double b, double a, double c) {
        double r557534 = b;
        double r557535 = -r557534;
        double r557536 = 2.0;
        double r557537 = pow(r557534, r557536);
        double r557538 = 4.0;
        double r557539 = a;
        double r557540 = r557538 * r557539;
        double r557541 = c;
        double r557542 = r557540 * r557541;
        double r557543 = r557537 - r557542;
        double r557544 = sqrt(r557543);
        double r557545 = r557535 + r557544;
        double r557546 = r557536 * r557539;
        double r557547 = r557545 / r557546;
        return r557547;
}

double f(double b, double a, double c) {
        double r557548 = b;
        double r557549 = 6.063221110256436e+25;
        bool r557550 = r557548 <= r557549;
        double r557551 = -r557548;
        double r557552 = 2.0;
        double r557553 = pow(r557548, r557552);
        double r557554 = 4.0;
        double r557555 = a;
        double r557556 = r557554 * r557555;
        double r557557 = c;
        double r557558 = r557556 * r557557;
        double r557559 = r557553 - r557558;
        double r557560 = sqrt(r557559);
        double r557561 = cbrt(r557560);
        double r557562 = r557561 * r557561;
        double r557563 = r557562 * r557561;
        double r557564 = r557551 + r557563;
        double r557565 = r557552 * r557555;
        double r557566 = r557564 / r557565;
        double r557567 = -2.0;
        double r557568 = r557555 * r557557;
        double r557569 = r557568 / r557548;
        double r557570 = r557567 * r557569;
        double r557571 = r557570 / r557565;
        double r557572 = r557550 ? r557566 : r557571;
        return r557572;
}

Error

Bits error versus b

Bits error versus a

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.063221110256436e+25

    1. Initial program 5.0

      \[\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt6.2

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

    if 6.063221110256436e+25 < b

    1. Initial program 19.4

      \[\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Taylor expanded around inf 5.1

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

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

Reproduce

herbie shell --seed 1 
(FPCore (b a c)
  :name "(-b+sqrt(b^2-4*a*c))/(2*a)"
  :precision binary32
  (/ (+ (- b) (sqrt (- (pow b 2) (* (* 4 a) c)))) (* 2 a)))