Average Error: 16.8 → 0.2
Time: 14.5s
Precision: 64
\[b \gt 0.0 \land {b}^{2} - 4 \cdot ac \ge 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 r3538880 = b;
        double r3538881 = -r3538880;
        double r3538882 = 2.0;
        double r3538883 = pow(r3538880, r3538882);
        double r3538884 = 4.0;
        double r3538885 = ac;
        double r3538886 = r3538884 * r3538885;
        double r3538887 = r3538883 - r3538886;
        double r3538888 = sqrt(r3538887);
        double r3538889 = r3538881 - r3538888;
        double r3538890 = a;
        double r3538891 = r3538882 * r3538890;
        double r3538892 = r3538889 / r3538891;
        return r3538892;
}

double f(double b, double ac, double a) {
        double r3538893 = b;
        double r3538894 = 1.0593523764334767e+147;
        bool r3538895 = r3538893 <= r3538894;
        double r3538896 = -r3538893;
        double r3538897 = 2.0;
        double r3538898 = a;
        double r3538899 = r3538897 * r3538898;
        double r3538900 = r3538896 / r3538899;
        double r3538901 = pow(r3538893, r3538897);
        double r3538902 = 4.0;
        double r3538903 = ac;
        double r3538904 = r3538902 * r3538903;
        double r3538905 = r3538901 - r3538904;
        double r3538906 = sqrt(r3538905);
        double r3538907 = r3538906 / r3538899;
        double r3538908 = r3538900 - r3538907;
        double r3538909 = r3538903 / r3538893;
        double r3538910 = r3538897 * r3538909;
        double r3538911 = 2.0;
        double r3538912 = r3538911 * r3538893;
        double r3538913 = r3538910 - r3538912;
        double r3538914 = r3538913 / r3538899;
        double r3538915 = r3538895 ? r3538908 : r3538914;
        return r3538915;
}

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 (and (> b 0.0) (>= (- (pow b 2) (* 4 ac)) 0.0))
  (/ (- (- b) (sqrt (- (pow b 2) (* 4 ac)))) (* 2 a)))