Average Error: 33.4 → 10.0
Time: 25.6s
Precision: 64
\[\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 -9.497374990683389 \cdot 10^{+62}:\\ \;\;\;\;-\frac{c}{b}\\ \mathbf{elif}\;b \le -9.280942802423785 \cdot 10^{+21}:\\ \;\;\;\;\frac{\left(-4 \cdot \left(c \cdot a\right)\right) \cdot \frac{\frac{-1}{2}}{a}}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{elif}\;b \le -2.6813599241700416 \cdot 10^{-50}:\\ \;\;\;\;-\frac{c}{b}\\ \mathbf{elif}\;b \le 1.451866749331113 \cdot 10^{+79}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{b + \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \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 -9.497374990683389 \cdot 10^{+62}:\\
\;\;\;\;-\frac{c}{b}\\

\mathbf{elif}\;b \le -9.280942802423785 \cdot 10^{+21}:\\
\;\;\;\;\frac{\left(-4 \cdot \left(c \cdot a\right)\right) \cdot \frac{\frac{-1}{2}}{a}}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\

\mathbf{elif}\;b \le -2.6813599241700416 \cdot 10^{-50}:\\
\;\;\;\;-\frac{c}{b}\\

\mathbf{elif}\;b \le 1.451866749331113 \cdot 10^{+79}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{b + \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{a}\\

\mathbf{else}:\\
\;\;\;\;\frac{-b}{a}\\

\end{array}
double f(double b, double a, double c) {
        double r40829021 = b;
        double r40829022 = -r40829021;
        double r40829023 = r40829021 * r40829021;
        double r40829024 = 4.0;
        double r40829025 = a;
        double r40829026 = r40829024 * r40829025;
        double r40829027 = c;
        double r40829028 = r40829026 * r40829027;
        double r40829029 = r40829023 - r40829028;
        double r40829030 = sqrt(r40829029);
        double r40829031 = r40829022 - r40829030;
        double r40829032 = 2.0;
        double r40829033 = r40829032 * r40829025;
        double r40829034 = r40829031 / r40829033;
        return r40829034;
}

double f(double b, double a, double c) {
        double r40829035 = b;
        double r40829036 = -9.497374990683389e+62;
        bool r40829037 = r40829035 <= r40829036;
        double r40829038 = c;
        double r40829039 = r40829038 / r40829035;
        double r40829040 = -r40829039;
        double r40829041 = -9.280942802423785e+21;
        bool r40829042 = r40829035 <= r40829041;
        double r40829043 = -4.0;
        double r40829044 = a;
        double r40829045 = r40829038 * r40829044;
        double r40829046 = r40829043 * r40829045;
        double r40829047 = -0.5;
        double r40829048 = r40829047 / r40829044;
        double r40829049 = r40829046 * r40829048;
        double r40829050 = -r40829035;
        double r40829051 = r40829035 * r40829035;
        double r40829052 = 4.0;
        double r40829053 = r40829052 * r40829044;
        double r40829054 = r40829053 * r40829038;
        double r40829055 = r40829051 - r40829054;
        double r40829056 = sqrt(r40829055);
        double r40829057 = r40829050 + r40829056;
        double r40829058 = r40829049 / r40829057;
        double r40829059 = -2.6813599241700416e-50;
        bool r40829060 = r40829035 <= r40829059;
        double r40829061 = 1.451866749331113e+79;
        bool r40829062 = r40829035 <= r40829061;
        double r40829063 = r40829045 * r40829052;
        double r40829064 = r40829051 - r40829063;
        double r40829065 = sqrt(r40829064);
        double r40829066 = r40829035 + r40829065;
        double r40829067 = r40829066 / r40829044;
        double r40829068 = r40829047 * r40829067;
        double r40829069 = r40829050 / r40829044;
        double r40829070 = r40829062 ? r40829068 : r40829069;
        double r40829071 = r40829060 ? r40829040 : r40829070;
        double r40829072 = r40829042 ? r40829058 : r40829071;
        double r40829073 = r40829037 ? r40829040 : r40829072;
        return r40829073;
}

Error

Bits error versus b

Bits error versus a

Bits error versus c

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 4 regimes
  2. if b < -9.497374990683389e+62 or -9.280942802423785e+21 < b < -2.6813599241700416e-50

    1. Initial program 53.9

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Taylor expanded around -inf 7.0

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}}\]
    3. Simplified7.0

      \[\leadsto \color{blue}{-\frac{c}{b}}\]

    if -9.497374990683389e+62 < b < -9.280942802423785e+21

    1. Initial program 46.9

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Using strategy rm
    3. Applied clear-num46.9

      \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}\]
    4. Using strategy rm
    5. Applied flip--46.9

      \[\leadsto \frac{1}{\frac{2 \cdot a}{\color{blue}{\frac{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}}\]
    6. Applied associate-/r/47.0

      \[\leadsto \frac{1}{\color{blue}{\frac{2 \cdot a}{\left(-b\right) \cdot \left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} \cdot \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}} \cdot \left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}\]
    7. Applied associate-/r*47.0

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

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

    if -2.6813599241700416e-50 < b < 1.451866749331113e+79

    1. Initial program 14.0

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Using strategy rm
    3. Applied clear-num14.1

      \[\leadsto \color{blue}{\frac{1}{\frac{2 \cdot a}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity14.1

      \[\leadsto \frac{1}{\frac{2 \cdot a}{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right)}}}\]
    6. Applied times-frac14.1

      \[\leadsto \frac{1}{\color{blue}{\frac{2}{1} \cdot \frac{a}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}}\]
    7. Applied *-un-lft-identity14.1

      \[\leadsto \frac{\color{blue}{1 \cdot 1}}{\frac{2}{1} \cdot \frac{a}{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}}\]
    8. Applied times-frac14.2

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

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

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

    if 1.451866749331113e+79 < b

    1. Initial program 40.4

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}\]
    2. Using strategy rm
    3. Applied clear-num40.5

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

      \[\leadsto \color{blue}{-1 \cdot \frac{b}{a}}\]
    5. Simplified5.3

      \[\leadsto \color{blue}{-\frac{b}{a}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification10.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -9.497374990683389 \cdot 10^{+62}:\\ \;\;\;\;-\frac{c}{b}\\ \mathbf{elif}\;b \le -9.280942802423785 \cdot 10^{+21}:\\ \;\;\;\;\frac{\left(-4 \cdot \left(c \cdot a\right)\right) \cdot \frac{\frac{-1}{2}}{a}}{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}\\ \mathbf{elif}\;b \le -2.6813599241700416 \cdot 10^{-50}:\\ \;\;\;\;-\frac{c}{b}\\ \mathbf{elif}\;b \le 1.451866749331113 \cdot 10^{+79}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{b + \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{a}\\ \mathbf{else}:\\ \;\;\;\;\frac{-b}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (b a c)
  :name "(-b - sqrt(b*b - 4*a*c))/(2 * a)"
  (/ (- (- b) (sqrt (- (* b b) (* (* 4 a) c)))) (* 2 a)))