Average Error: 18.0 → 1.8
Time: 16.2s
Precision: 64
\[\left(-b\right) + \frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2} \cdot a\]
\[\begin{array}{l} \mathbf{if}\;b \le -1.348495931813199651380956550510723066785 \cdot 10^{154}:\\ \;\;\;\;\left(-b\right) + \left(\frac{c \cdot \left(\left(a \cdot a\right) \cdot 0.5\right)}{b} \cdot 2 - 0.5 \cdot \left(b \cdot a\right)\right)\\ \mathbf{elif}\;b \le 7.455214655191518431487537897984841909544 \cdot 10^{99}:\\ \;\;\;\;\left(-b\right) + \frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2} \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(-b\right) + \left(0.5 \cdot \left(a \cdot b\right) - 1 \cdot \frac{{a}^{2} \cdot c}{b}\right)\\ \end{array}\]
\left(-b\right) + \frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2} \cdot a
\begin{array}{l}
\mathbf{if}\;b \le -1.348495931813199651380956550510723066785 \cdot 10^{154}:\\
\;\;\;\;\left(-b\right) + \left(\frac{c \cdot \left(\left(a \cdot a\right) \cdot 0.5\right)}{b} \cdot 2 - 0.5 \cdot \left(b \cdot a\right)\right)\\

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

\mathbf{else}:\\
\;\;\;\;\left(-b\right) + \left(0.5 \cdot \left(a \cdot b\right) - 1 \cdot \frac{{a}^{2} \cdot c}{b}\right)\\

\end{array}
double f(double b, double a, double c) {
        double r2131585 = b;
        double r2131586 = -r2131585;
        double r2131587 = 2.0;
        double r2131588 = pow(r2131585, r2131587);
        double r2131589 = 4.0;
        double r2131590 = a;
        double r2131591 = r2131589 * r2131590;
        double r2131592 = c;
        double r2131593 = r2131591 * r2131592;
        double r2131594 = r2131588 - r2131593;
        double r2131595 = sqrt(r2131594);
        double r2131596 = r2131595 / r2131587;
        double r2131597 = r2131596 * r2131590;
        double r2131598 = r2131586 + r2131597;
        return r2131598;
}

double f(double b, double a, double c) {
        double r2131599 = b;
        double r2131600 = -1.3484959318131997e+154;
        bool r2131601 = r2131599 <= r2131600;
        double r2131602 = -r2131599;
        double r2131603 = c;
        double r2131604 = a;
        double r2131605 = r2131604 * r2131604;
        double r2131606 = 0.5;
        double r2131607 = r2131605 * r2131606;
        double r2131608 = r2131603 * r2131607;
        double r2131609 = r2131608 / r2131599;
        double r2131610 = 2.0;
        double r2131611 = r2131609 * r2131610;
        double r2131612 = r2131599 * r2131604;
        double r2131613 = r2131606 * r2131612;
        double r2131614 = r2131611 - r2131613;
        double r2131615 = r2131602 + r2131614;
        double r2131616 = 7.455214655191518e+99;
        bool r2131617 = r2131599 <= r2131616;
        double r2131618 = pow(r2131599, r2131610);
        double r2131619 = 4.0;
        double r2131620 = r2131619 * r2131604;
        double r2131621 = r2131620 * r2131603;
        double r2131622 = r2131618 - r2131621;
        double r2131623 = sqrt(r2131622);
        double r2131624 = r2131623 / r2131610;
        double r2131625 = r2131624 * r2131604;
        double r2131626 = r2131602 + r2131625;
        double r2131627 = r2131604 * r2131599;
        double r2131628 = r2131606 * r2131627;
        double r2131629 = 1.0;
        double r2131630 = 2.0;
        double r2131631 = pow(r2131604, r2131630);
        double r2131632 = r2131631 * r2131603;
        double r2131633 = r2131632 / r2131599;
        double r2131634 = r2131629 * r2131633;
        double r2131635 = r2131628 - r2131634;
        double r2131636 = r2131602 + r2131635;
        double r2131637 = r2131617 ? r2131626 : r2131636;
        double r2131638 = r2131601 ? r2131615 : r2131637;
        return r2131638;
}

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 < -1.3484959318131997e+154

    1. Initial program 64.0

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

      \[\leadsto \left(-b\right) + \color{blue}{\left(\sqrt{\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}} \cdot \sqrt{\frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2}}\right)} \cdot a\]
    4. Applied associate-*l*64.0

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

      \[\leadsto \left(-b\right) + \color{blue}{\left(2 \cdot \frac{{a}^{2} \cdot \left({\left(\sqrt{0.5}\right)}^{2} \cdot c\right)}{b} - a \cdot \left({\left(\sqrt{0.5}\right)}^{2} \cdot b\right)\right)}\]
    6. Simplified1.9

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

    if -1.3484959318131997e+154 < b < 7.455214655191518e+99

    1. Initial program 1.4

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

    if 7.455214655191518e+99 < b

    1. Initial program 44.5

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

      \[\leadsto \left(-b\right) + \color{blue}{\left(0.5 \cdot \left(a \cdot b\right) - 1 \cdot \frac{{a}^{2} \cdot c}{b}\right)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification1.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -1.348495931813199651380956550510723066785 \cdot 10^{154}:\\ \;\;\;\;\left(-b\right) + \left(\frac{c \cdot \left(\left(a \cdot a\right) \cdot 0.5\right)}{b} \cdot 2 - 0.5 \cdot \left(b \cdot a\right)\right)\\ \mathbf{elif}\;b \le 7.455214655191518431487537897984841909544 \cdot 10^{99}:\\ \;\;\;\;\left(-b\right) + \frac{\sqrt{{b}^{2} - \left(4 \cdot a\right) \cdot c}}{2} \cdot a\\ \mathbf{else}:\\ \;\;\;\;\left(-b\right) + \left(0.5 \cdot \left(a \cdot b\right) - 1 \cdot \frac{{a}^{2} \cdot c}{b}\right)\\ \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)))