Average Error: 44.0 → 11.2
Time: 18.8s
Precision: 64
\[1.1102230246251565 \cdot 10^{-16} \lt a \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt b \lt 9007199254740992.0 \land 1.1102230246251565 \cdot 10^{-16} \lt c \lt 9007199254740992.0\]
\[\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 0.12005985553413497:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b + \left(c \cdot a\right) \cdot -4\right) \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + \left(c \cdot a\right) \cdot -4\right) + b \cdot \left(b + \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}\right)}}{a}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{c}{b}}{2}\\ \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 0.12005985553413497:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b + \left(c \cdot a\right) \cdot -4\right) \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + \left(c \cdot a\right) \cdot -4\right) + b \cdot \left(b + \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4}\right)}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1495946 = b;
        double r1495947 = -r1495946;
        double r1495948 = r1495946 * r1495946;
        double r1495949 = 4.0;
        double r1495950 = a;
        double r1495951 = r1495949 * r1495950;
        double r1495952 = c;
        double r1495953 = r1495951 * r1495952;
        double r1495954 = r1495948 - r1495953;
        double r1495955 = sqrt(r1495954);
        double r1495956 = r1495947 + r1495955;
        double r1495957 = 2.0;
        double r1495958 = r1495957 * r1495950;
        double r1495959 = r1495956 / r1495958;
        return r1495959;
}

double f(double a, double b, double c) {
        double r1495960 = b;
        double r1495961 = 0.12005985553413497;
        bool r1495962 = r1495960 <= r1495961;
        double r1495963 = r1495960 * r1495960;
        double r1495964 = c;
        double r1495965 = a;
        double r1495966 = r1495964 * r1495965;
        double r1495967 = -4.0;
        double r1495968 = r1495966 * r1495967;
        double r1495969 = r1495963 + r1495968;
        double r1495970 = sqrt(r1495969);
        double r1495971 = r1495969 * r1495970;
        double r1495972 = r1495963 * r1495960;
        double r1495973 = r1495971 - r1495972;
        double r1495974 = r1495960 + r1495970;
        double r1495975 = r1495960 * r1495974;
        double r1495976 = r1495969 + r1495975;
        double r1495977 = r1495973 / r1495976;
        double r1495978 = r1495977 / r1495965;
        double r1495979 = 2.0;
        double r1495980 = r1495978 / r1495979;
        double r1495981 = -2.0;
        double r1495982 = r1495964 / r1495960;
        double r1495983 = r1495981 * r1495982;
        double r1495984 = r1495983 / r1495979;
        double r1495985 = r1495962 ? r1495980 : r1495984;
        return r1495985;
}

Error

Bits error versus a

Bits error versus b

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 < 0.12005985553413497

    1. Initial program 23.2

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

      \[\leadsto \color{blue}{\frac{\frac{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b}{a}}{2}}\]
    3. Using strategy rm
    4. Applied flip3--23.3

      \[\leadsto \frac{\frac{\color{blue}{\frac{{\left(\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}\right)}^{3} - {b}^{3}}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} \cdot \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} + \left(b \cdot b + \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} \cdot b\right)}}}{a}}{2}\]
    5. Simplified22.7

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

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

    if 0.12005985553413497 < b

    1. Initial program 47.2

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

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

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

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

Reproduce

herbie shell --seed 2019146 
(FPCore (a b c)
  :name "Quadratic roots, medium range"
  :pre (and (< 1.1102230246251565e-16 a 9007199254740992.0) (< 1.1102230246251565e-16 b 9007199254740992.0) (< 1.1102230246251565e-16 c 9007199254740992.0))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))