Average Error: 33.5 → 29.3
Time: 21.6s
Precision: 64
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 1.1503681818569007 \cdot 10^{+121}:\\ \;\;\;\;\frac{\frac{\sqrt{a \cdot \left(-4 \cdot c\right) + b \cdot b} - b}{a}}{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 1.1503681818569007 \cdot 10^{+121}:\\
\;\;\;\;\frac{\frac{\sqrt{a \cdot \left(-4 \cdot c\right) + b \cdot b} - b}{a}}{2}\\

\mathbf{else}:\\
\;\;\;\;0\\

\end{array}
double f(double b, double a, double c) {
        double r2608751 = b;
        double r2608752 = -r2608751;
        double r2608753 = r2608751 * r2608751;
        double r2608754 = 4.0;
        double r2608755 = a;
        double r2608756 = r2608754 * r2608755;
        double r2608757 = c;
        double r2608758 = r2608756 * r2608757;
        double r2608759 = r2608753 - r2608758;
        double r2608760 = sqrt(r2608759);
        double r2608761 = r2608752 + r2608760;
        double r2608762 = 2.0;
        double r2608763 = r2608762 * r2608755;
        double r2608764 = r2608761 / r2608763;
        return r2608764;
}

double f(double b, double a, double c) {
        double r2608765 = b;
        double r2608766 = 1.1503681818569007e+121;
        bool r2608767 = r2608765 <= r2608766;
        double r2608768 = a;
        double r2608769 = -4.0;
        double r2608770 = c;
        double r2608771 = r2608769 * r2608770;
        double r2608772 = r2608768 * r2608771;
        double r2608773 = r2608765 * r2608765;
        double r2608774 = r2608772 + r2608773;
        double r2608775 = sqrt(r2608774);
        double r2608776 = r2608775 - r2608765;
        double r2608777 = r2608776 / r2608768;
        double r2608778 = 2.0;
        double r2608779 = r2608777 / r2608778;
        double r2608780 = 0.0;
        double r2608781 = r2608767 ? r2608779 : r2608780;
        return r2608781;
}

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 < 1.1503681818569007e+121

    1. Initial program 26.2

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

      \[\leadsto \color{blue}{\frac{\sqrt{a \cdot \left(-4 \cdot c\right) + b \cdot b} - b}{a \cdot 2}}\]
    3. Using strategy rm
    4. Applied associate-/r*26.2

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

    if 1.1503681818569007e+121 < b

    1. Initial program 59.8

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

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

      \[\leadsto \color{blue}{0}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification29.3

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

Reproduce

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