Average Error: 43.6 → 11.1
Time: 23.5s
Precision: 64
\[1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt a \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt b \lt 9007199254740992 \land 1.1102230246251565404236316680908203125 \cdot 10^{-16} \lt c \lt 9007199254740992\]
\[\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 8.984490456930243999777996322109174798243 \cdot 10^{-5}:\\ \;\;\;\;\frac{\frac{\left(b \cdot b - 4 \cdot \left(a \cdot c\right)\right) \cdot \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + \left(b \cdot b - 4 \cdot \left(a \cdot c\right)\right)\right) + b \cdot \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot -1\\ \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 8.984490456930243999777996322109174798243 \cdot 10^{-5}:\\
\;\;\;\;\frac{\frac{\left(b \cdot b - 4 \cdot \left(a \cdot c\right)\right) \cdot \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + \left(b \cdot b - 4 \cdot \left(a \cdot c\right)\right)\right) + b \cdot \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}}{2 \cdot a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r2288643 = b;
        double r2288644 = -r2288643;
        double r2288645 = r2288643 * r2288643;
        double r2288646 = 4.0;
        double r2288647 = a;
        double r2288648 = r2288646 * r2288647;
        double r2288649 = c;
        double r2288650 = r2288648 * r2288649;
        double r2288651 = r2288645 - r2288650;
        double r2288652 = sqrt(r2288651);
        double r2288653 = r2288644 + r2288652;
        double r2288654 = 2.0;
        double r2288655 = r2288654 * r2288647;
        double r2288656 = r2288653 / r2288655;
        return r2288656;
}

double f(double a, double b, double c) {
        double r2288657 = b;
        double r2288658 = 8.984490456930244e-05;
        bool r2288659 = r2288657 <= r2288658;
        double r2288660 = r2288657 * r2288657;
        double r2288661 = 4.0;
        double r2288662 = a;
        double r2288663 = c;
        double r2288664 = r2288662 * r2288663;
        double r2288665 = r2288661 * r2288664;
        double r2288666 = r2288660 - r2288665;
        double r2288667 = sqrt(r2288666);
        double r2288668 = r2288666 * r2288667;
        double r2288669 = r2288660 * r2288657;
        double r2288670 = r2288668 - r2288669;
        double r2288671 = r2288660 + r2288666;
        double r2288672 = r2288657 * r2288667;
        double r2288673 = r2288671 + r2288672;
        double r2288674 = r2288670 / r2288673;
        double r2288675 = 2.0;
        double r2288676 = r2288675 * r2288662;
        double r2288677 = r2288674 / r2288676;
        double r2288678 = r2288663 / r2288657;
        double r2288679 = -1.0;
        double r2288680 = r2288678 * r2288679;
        double r2288681 = r2288659 ? r2288677 : r2288680;
        return r2288681;
}

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 < 8.984490456930244e-05

    1. Initial program 17.3

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

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

      \[\leadsto \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)}}}{2 \cdot a}\]
    5. Simplified16.6

      \[\leadsto \frac{\frac{\color{blue}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} \cdot \left(b \cdot b - 4 \cdot \left(a \cdot c\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)}}{2 \cdot a}\]
    6. Simplified16.6

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

    if 8.984490456930244e-05 < b

    1. Initial program 45.5

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

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

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

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

Reproduce

herbie shell --seed 2019200 
(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.0 a) c)))) (* 2.0 a)))