Average Error: 28.6 → 16.5
Time: 17.2s
Precision: 64
\[1.0536712127723509 \cdot 10^{-08} \lt a \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt b \lt 94906265.62425156 \land 1.0536712127723509 \cdot 10^{-08} \lt c \lt 94906265.62425156\]
\[\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 174.55343675894656:\\ \;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} + b \cdot b\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 174.55343675894656:\\
\;\;\;\;\frac{\frac{\frac{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} - \left(b \cdot b\right) \cdot b}{\left(b \cdot b + a \cdot \left(-4 \cdot c\right)\right) + \left(b \cdot \sqrt{b \cdot b + a \cdot \left(-4 \cdot c\right)} + b \cdot b\right)}}{a}}{2}\\

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

\end{array}
double f(double a, double b, double c) {
        double r1520707 = b;
        double r1520708 = -r1520707;
        double r1520709 = r1520707 * r1520707;
        double r1520710 = 4.0;
        double r1520711 = a;
        double r1520712 = r1520710 * r1520711;
        double r1520713 = c;
        double r1520714 = r1520712 * r1520713;
        double r1520715 = r1520709 - r1520714;
        double r1520716 = sqrt(r1520715);
        double r1520717 = r1520708 + r1520716;
        double r1520718 = 2.0;
        double r1520719 = r1520718 * r1520711;
        double r1520720 = r1520717 / r1520719;
        return r1520720;
}

double f(double a, double b, double c) {
        double r1520721 = b;
        double r1520722 = 174.55343675894656;
        bool r1520723 = r1520721 <= r1520722;
        double r1520724 = r1520721 * r1520721;
        double r1520725 = a;
        double r1520726 = -4.0;
        double r1520727 = c;
        double r1520728 = r1520726 * r1520727;
        double r1520729 = r1520725 * r1520728;
        double r1520730 = r1520724 + r1520729;
        double r1520731 = sqrt(r1520730);
        double r1520732 = r1520730 * r1520731;
        double r1520733 = r1520724 * r1520721;
        double r1520734 = r1520732 - r1520733;
        double r1520735 = r1520721 * r1520731;
        double r1520736 = r1520735 + r1520724;
        double r1520737 = r1520730 + r1520736;
        double r1520738 = r1520734 / r1520737;
        double r1520739 = r1520738 / r1520725;
        double r1520740 = 2.0;
        double r1520741 = r1520739 / r1520740;
        double r1520742 = -2.0;
        double r1520743 = r1520727 / r1520721;
        double r1520744 = r1520742 * r1520743;
        double r1520745 = r1520744 / r1520740;
        double r1520746 = r1520723 ? r1520741 : r1520745;
        return r1520746;
}

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

    1. Initial program 15.7

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

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

      \[\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. Simplified15.1

      \[\leadsto \frac{\frac{\frac{\color{blue}{\sqrt{b \cdot b + \left(-4 \cdot c\right) \cdot a} \cdot \left(b \cdot b + \left(-4 \cdot c\right) \cdot a\right) - b \cdot \left(b \cdot b\right)}}{\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. Simplified15.0

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

    if 174.55343675894656 < b

    1. Initial program 35.0

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

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

      \[\leadsto \frac{\frac{\color{blue}{-2 \cdot \frac{a \cdot c}{b}}}{a}}{2}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity17.3

      \[\leadsto \frac{\frac{-2 \cdot \frac{a \cdot c}{\color{blue}{1 \cdot b}}}{a}}{2}\]
    6. Applied times-frac17.2

      \[\leadsto \frac{\frac{-2 \cdot \color{blue}{\left(\frac{a}{1} \cdot \frac{c}{b}\right)}}{a}}{2}\]
    7. Simplified17.2

      \[\leadsto \frac{\frac{-2 \cdot \left(\color{blue}{a} \cdot \frac{c}{b}\right)}{a}}{2}\]
    8. Using strategy rm
    9. Applied *-un-lft-identity17.2

      \[\leadsto \frac{\frac{-2 \cdot \left(a \cdot \frac{c}{b}\right)}{\color{blue}{1 \cdot a}}}{2}\]
    10. Applied times-frac17.2

      \[\leadsto \frac{\color{blue}{\frac{-2}{1} \cdot \frac{a \cdot \frac{c}{b}}{a}}}{2}\]
    11. Simplified17.2

      \[\leadsto \frac{\color{blue}{-2} \cdot \frac{a \cdot \frac{c}{b}}{a}}{2}\]
    12. Simplified17.2

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

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

Reproduce

herbie shell --seed 2019158 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :pre (and (< 1.0536712127723509e-08 a 94906265.62425156) (< 1.0536712127723509e-08 b 94906265.62425156) (< 1.0536712127723509e-08 c 94906265.62425156))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))