Average Error: 43.7 → 11.3
Time: 23.4s
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.01232011122987302:\\ \;\;\;\;\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}{b \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} + \left(b \cdot b + \left(b \cdot b + \left(c \cdot a\right) \cdot -4\right)\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.01232011122987302:\\
\;\;\;\;\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}{b \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} + \left(b \cdot b + \left(b \cdot b + \left(c \cdot a\right) \cdot -4\right)\right)}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1421636 = b;
        double r1421637 = -r1421636;
        double r1421638 = r1421636 * r1421636;
        double r1421639 = 4.0;
        double r1421640 = a;
        double r1421641 = r1421639 * r1421640;
        double r1421642 = c;
        double r1421643 = r1421641 * r1421642;
        double r1421644 = r1421638 - r1421643;
        double r1421645 = sqrt(r1421644);
        double r1421646 = r1421637 + r1421645;
        double r1421647 = 2.0;
        double r1421648 = r1421647 * r1421640;
        double r1421649 = r1421646 / r1421648;
        return r1421649;
}

double f(double a, double b, double c) {
        double r1421650 = b;
        double r1421651 = 0.01232011122987302;
        bool r1421652 = r1421650 <= r1421651;
        double r1421653 = r1421650 * r1421650;
        double r1421654 = c;
        double r1421655 = a;
        double r1421656 = r1421654 * r1421655;
        double r1421657 = -4.0;
        double r1421658 = r1421656 * r1421657;
        double r1421659 = r1421653 + r1421658;
        double r1421660 = sqrt(r1421659);
        double r1421661 = r1421659 * r1421660;
        double r1421662 = r1421653 * r1421650;
        double r1421663 = r1421661 - r1421662;
        double r1421664 = r1421650 * r1421660;
        double r1421665 = r1421653 + r1421659;
        double r1421666 = r1421664 + r1421665;
        double r1421667 = r1421663 / r1421666;
        double r1421668 = r1421667 / r1421655;
        double r1421669 = 2.0;
        double r1421670 = r1421668 / r1421669;
        double r1421671 = -2.0;
        double r1421672 = r1421654 / r1421650;
        double r1421673 = r1421671 * r1421672;
        double r1421674 = r1421673 / r1421669;
        double r1421675 = r1421652 ? r1421670 : r1421674;
        return r1421675;
}

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.01232011122987302

    1. Initial program 22.0

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

      \[\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--22.1

      \[\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. Simplified21.4

      \[\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. Simplified21.4

      \[\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}{b \cdot \sqrt{b \cdot b + -4 \cdot \left(c \cdot a\right)} + \left(b \cdot b + \left(b \cdot b + -4 \cdot \left(c \cdot a\right)\right)\right)}}}{a}}{2}\]

    if 0.01232011122987302 < b

    1. Initial program 46.5

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le 0.01232011122987302:\\ \;\;\;\;\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}{b \cdot \sqrt{b \cdot b + \left(c \cdot a\right) \cdot -4} + \left(b \cdot b + \left(b \cdot b + \left(c \cdot a\right) \cdot -4\right)\right)}}{a}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{-2 \cdot \frac{c}{b}}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019141 
(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)))