Average Error: 16.8 → 0.2
Time: 17.3s
Precision: 64
\[b \gt 0.0\]
\[\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le 1.059352376433476713791485373411616932263 \cdot 10^{147}:\\ \;\;\;\;\frac{-b}{2 \cdot a} - \frac{\sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \frac{ac}{b} - 2 \cdot b}{2 \cdot a}\\ \end{array}\]
\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le 1.059352376433476713791485373411616932263 \cdot 10^{147}:\\
\;\;\;\;\frac{-b}{2 \cdot a} - \frac{\sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\\

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

\end{array}
double f(double b, double ac, double a) {
        double r3528995 = b;
        double r3528996 = -r3528995;
        double r3528997 = 2.0;
        double r3528998 = pow(r3528995, r3528997);
        double r3528999 = 4.0;
        double r3529000 = ac;
        double r3529001 = r3528999 * r3529000;
        double r3529002 = r3528998 - r3529001;
        double r3529003 = sqrt(r3529002);
        double r3529004 = r3528996 - r3529003;
        double r3529005 = a;
        double r3529006 = r3528997 * r3529005;
        double r3529007 = r3529004 / r3529006;
        return r3529007;
}

double f(double b, double ac, double a) {
        double r3529008 = b;
        double r3529009 = 1.0593523764334767e+147;
        bool r3529010 = r3529008 <= r3529009;
        double r3529011 = -r3529008;
        double r3529012 = 2.0;
        double r3529013 = a;
        double r3529014 = r3529012 * r3529013;
        double r3529015 = r3529011 / r3529014;
        double r3529016 = pow(r3529008, r3529012);
        double r3529017 = 4.0;
        double r3529018 = ac;
        double r3529019 = r3529017 * r3529018;
        double r3529020 = r3529016 - r3529019;
        double r3529021 = sqrt(r3529020);
        double r3529022 = r3529021 / r3529014;
        double r3529023 = r3529015 - r3529022;
        double r3529024 = r3529018 / r3529008;
        double r3529025 = r3529012 * r3529024;
        double r3529026 = 2.0;
        double r3529027 = r3529026 * r3529008;
        double r3529028 = r3529025 - r3529027;
        double r3529029 = r3529028 / r3529014;
        double r3529030 = r3529010 ? r3529023 : r3529029;
        return r3529030;
}

Error

Bits error versus b

Bits error versus ac

Bits error versus a

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.0593523764334767e+147

    1. Initial program 0.2

      \[\frac{\left(-b\right) - \sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\]
    2. Using strategy rm
    3. Applied div-sub0.2

      \[\leadsto \color{blue}{\frac{-b}{2 \cdot a} - \frac{\sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}}\]

    if 1.0593523764334767e+147 < b

    1. Initial program 60.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 1.059352376433476713791485373411616932263 \cdot 10^{147}:\\ \;\;\;\;\frac{-b}{2 \cdot a} - \frac{\sqrt{{b}^{2} - 4 \cdot ac}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{2 \cdot \frac{ac}{b} - 2 \cdot b}{2 \cdot a}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (b ac a)
  :name "(-b-sqrt(b^2-4ac))/(2a)"
  :precision binary64
  :pre (> b 0.0)
  (/ (- (- b) (sqrt (- (pow b 2) (* 4 ac)))) (* 2 a)))