Average Error: 33.4 → 10.3
Time: 18.7s
Precision: 64
\[\frac{\left(-b\right) - \sqrt{b \cdot b - a \cdot c}}{a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -9.497374990683389 \cdot 10^{+62}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le -9.280942802423785 \cdot 10^{+21}:\\ \;\;\;\;\frac{\frac{c \cdot a}{\sqrt{b \cdot b - c \cdot a} - b}}{a}\\ \mathbf{elif}\;b \le -2.6813599241700416 \cdot 10^{-50}:\\ \;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 2.0124862873637464 \cdot 10^{+45}:\\ \;\;\;\;\frac{1}{\frac{a}{\left(-b\right) - \sqrt{b \cdot b - c \cdot a}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{b} \cdot \frac{1}{2} - \frac{b}{a} \cdot 2\\ \end{array}\]
\frac{\left(-b\right) - \sqrt{b \cdot b - a \cdot c}}{a}
\begin{array}{l}
\mathbf{if}\;b \le -9.497374990683389 \cdot 10^{+62}:\\
\;\;\;\;\frac{-1}{2} \cdot \frac{c}{b}\\

\mathbf{elif}\;b \le -9.280942802423785 \cdot 10^{+21}:\\
\;\;\;\;\frac{\frac{c \cdot a}{\sqrt{b \cdot b - c \cdot a} - b}}{a}\\

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

\mathbf{elif}\;b \le 2.0124862873637464 \cdot 10^{+45}:\\
\;\;\;\;\frac{1}{\frac{a}{\left(-b\right) - \sqrt{b \cdot b - c \cdot a}}}\\

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

\end{array}
double f(double b, double a, double c) {
        double r7267745 = b;
        double r7267746 = -r7267745;
        double r7267747 = r7267745 * r7267745;
        double r7267748 = a;
        double r7267749 = c;
        double r7267750 = r7267748 * r7267749;
        double r7267751 = r7267747 - r7267750;
        double r7267752 = sqrt(r7267751);
        double r7267753 = r7267746 - r7267752;
        double r7267754 = r7267753 / r7267748;
        return r7267754;
}

double f(double b, double a, double c) {
        double r7267755 = b;
        double r7267756 = -9.497374990683389e+62;
        bool r7267757 = r7267755 <= r7267756;
        double r7267758 = -0.5;
        double r7267759 = c;
        double r7267760 = r7267759 / r7267755;
        double r7267761 = r7267758 * r7267760;
        double r7267762 = -9.280942802423785e+21;
        bool r7267763 = r7267755 <= r7267762;
        double r7267764 = a;
        double r7267765 = r7267759 * r7267764;
        double r7267766 = r7267755 * r7267755;
        double r7267767 = r7267766 - r7267765;
        double r7267768 = sqrt(r7267767);
        double r7267769 = r7267768 - r7267755;
        double r7267770 = r7267765 / r7267769;
        double r7267771 = r7267770 / r7267764;
        double r7267772 = -2.6813599241700416e-50;
        bool r7267773 = r7267755 <= r7267772;
        double r7267774 = 2.0124862873637464e+45;
        bool r7267775 = r7267755 <= r7267774;
        double r7267776 = 1.0;
        double r7267777 = -r7267755;
        double r7267778 = r7267777 - r7267768;
        double r7267779 = r7267764 / r7267778;
        double r7267780 = r7267776 / r7267779;
        double r7267781 = 0.5;
        double r7267782 = r7267760 * r7267781;
        double r7267783 = r7267755 / r7267764;
        double r7267784 = 2.0;
        double r7267785 = r7267783 * r7267784;
        double r7267786 = r7267782 - r7267785;
        double r7267787 = r7267775 ? r7267780 : r7267786;
        double r7267788 = r7267773 ? r7267761 : r7267787;
        double r7267789 = r7267763 ? r7267771 : r7267788;
        double r7267790 = r7267757 ? r7267761 : r7267789;
        return r7267790;
}

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 - a \cdot c}}{a}\]
    2. Taylor expanded around -inf 7.0

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

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

    1. Initial program 46.8

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied flip--46.9

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

      \[\leadsto \frac{\frac{\color{blue}{0 + a \cdot c}}{\left(-b\right) + \sqrt{b \cdot b - a \cdot c}}}{a}\]
    5. Simplified13.8

      \[\leadsto \frac{\frac{0 + a \cdot c}{\color{blue}{\sqrt{b \cdot b - a \cdot c} - b}}}{a}\]

    if -2.6813599241700416e-50 < b < 2.0124862873637464e+45

    1. Initial program 14.6

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - a \cdot c}}{a}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity14.6

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

      \[\leadsto \frac{\left(-\color{blue}{1 \cdot b}\right) - 1 \cdot \sqrt{b \cdot b - a \cdot c}}{a}\]
    5. Applied distribute-rgt-neg-in14.6

      \[\leadsto \frac{\color{blue}{1 \cdot \left(-b\right)} - 1 \cdot \sqrt{b \cdot b - a \cdot c}}{a}\]
    6. Applied distribute-lft-out--14.6

      \[\leadsto \frac{\color{blue}{1 \cdot \left(\left(-b\right) - \sqrt{b \cdot b - a \cdot c}\right)}}{a}\]
    7. Applied associate-/l*14.7

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

    if 2.0124862873637464e+45 < b

    1. Initial program 35.6

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

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

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

Reproduce

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