Average Error: 34.2 → 9.9
Time: 16.1s
Precision: 64
\[\frac{\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -2.940001550635406357572527191036557327772 \cdot 10^{93}:\\ \;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\ \mathbf{elif}\;b \le 2.592868408155405548302080990651854167189 \cdot 10^{-64}:\\ \;\;\;\;\frac{\sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array}\]
\frac{\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}}{a}
\begin{array}{l}
\mathbf{if}\;b \le -2.940001550635406357572527191036557327772 \cdot 10^{93}:\\
\;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\

\mathbf{elif}\;b \le 2.592868408155405548302080990651854167189 \cdot 10^{-64}:\\
\;\;\;\;\frac{\sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\

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

\end{array}
double f(double b, double a, double c) {
        double r495580 = b;
        double r495581 = -r495580;
        double r495582 = 2.0;
        double r495583 = pow(r495580, r495582);
        double r495584 = 4.0;
        double r495585 = a;
        double r495586 = r495584 * r495585;
        double r495587 = c;
        double r495588 = r495586 * r495587;
        double r495589 = r495583 - r495588;
        double r495590 = sqrt(r495589);
        double r495591 = r495581 + r495590;
        double r495592 = r495591 / r495582;
        double r495593 = r495592 / r495585;
        return r495593;
}

double f(double b, double a, double c) {
        double r495594 = b;
        double r495595 = -2.9400015506354064e+93;
        bool r495596 = r495594 <= r495595;
        double r495597 = 1.0;
        double r495598 = c;
        double r495599 = r495598 / r495594;
        double r495600 = a;
        double r495601 = r495594 / r495600;
        double r495602 = r495599 - r495601;
        double r495603 = r495597 * r495602;
        double r495604 = 2.5928684081554055e-64;
        bool r495605 = r495594 <= r495604;
        double r495606 = 2.0;
        double r495607 = pow(r495594, r495606);
        double r495608 = 4.0;
        double r495609 = r495600 * r495598;
        double r495610 = r495608 * r495609;
        double r495611 = r495607 - r495610;
        double r495612 = sqrt(r495611);
        double r495613 = r495612 - r495594;
        double r495614 = 2.0;
        double r495615 = r495600 * r495614;
        double r495616 = r495613 / r495615;
        double r495617 = -1.0;
        double r495618 = r495617 * r495599;
        double r495619 = r495605 ? r495616 : r495618;
        double r495620 = r495596 ? r495603 : r495619;
        return r495620;
}

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 3 regimes
  2. if b < -2.9400015506354064e+93

    1. Initial program 45.8

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

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

      \[\leadsto \color{blue}{1 \cdot \frac{c}{b} - 1 \cdot \frac{b}{a}}\]
    4. Simplified3.3

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

    if -2.9400015506354064e+93 < b < 2.5928684081554055e-64

    1. Initial program 13.0

      \[\frac{\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}}{a}\]
    2. Simplified13.0

      \[\leadsto \color{blue}{\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2}}\]
    3. Taylor expanded around 0 13.0

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

    if 2.5928684081554055e-64 < b

    1. Initial program 53.6

      \[\frac{\frac{\left(-b\right) + \sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}}{a}\]
    2. Simplified53.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -2.940001550635406357572527191036557327772 \cdot 10^{93}:\\ \;\;\;\;1 \cdot \left(\frac{c}{b} - \frac{b}{a}\right)\\ \mathbf{elif}\;b \le 2.592868408155405548302080990651854167189 \cdot 10^{-64}:\\ \;\;\;\;\frac{\sqrt{{b}^{2} - 4 \cdot \left(a \cdot c\right)} - b}{a \cdot 2}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \end{array}\]

Reproduce

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