Average Error: 34.4 → 10.0
Time: 19.7s
Precision: 64
\[b \cdot b \ge 4 \cdot \left(a \cdot c\right) \land a \ne 0.0\]
\[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
\[\begin{array}{l} \mathbf{if}\;b \le -4.050400227132123126450622263167578574691 \cdot 10^{61}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le -1.828633630853057376541934728602446135539 \cdot 10^{-44}:\\ \;\;\;\;\frac{\left(c \cdot a\right) \cdot 4}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b} \cdot \frac{1}{2 \cdot a}\\ \mathbf{elif}\;b \le -3.245501722148600476612050122411453201185 \cdot 10^{-102}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 1.65486856551139146661393840138316932172 \cdot 10^{96}:\\ \;\;\;\;\frac{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \end{array}\]
\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}
\begin{array}{l}
\mathbf{if}\;b \le -4.050400227132123126450622263167578574691 \cdot 10^{61}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\

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

\mathbf{elif}\;b \le -3.245501722148600476612050122411453201185 \cdot 10^{-102}:\\
\;\;\;\;-1 \cdot \frac{c}{b}\\

\mathbf{elif}\;b \le 1.65486856551139146661393840138316932172 \cdot 10^{96}:\\
\;\;\;\;\frac{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2}}{a}\\

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

\end{array}
double f(double a, double b, double c) {
        double r15959530 = b;
        double r15959531 = -r15959530;
        double r15959532 = r15959530 * r15959530;
        double r15959533 = 4.0;
        double r15959534 = a;
        double r15959535 = c;
        double r15959536 = r15959534 * r15959535;
        double r15959537 = r15959533 * r15959536;
        double r15959538 = r15959532 - r15959537;
        double r15959539 = sqrt(r15959538);
        double r15959540 = r15959531 - r15959539;
        double r15959541 = 2.0;
        double r15959542 = r15959541 * r15959534;
        double r15959543 = r15959540 / r15959542;
        return r15959543;
}

double f(double a, double b, double c) {
        double r15959544 = b;
        double r15959545 = -4.050400227132123e+61;
        bool r15959546 = r15959544 <= r15959545;
        double r15959547 = -1.0;
        double r15959548 = c;
        double r15959549 = r15959548 / r15959544;
        double r15959550 = r15959547 * r15959549;
        double r15959551 = -1.8286336308530574e-44;
        bool r15959552 = r15959544 <= r15959551;
        double r15959553 = a;
        double r15959554 = r15959548 * r15959553;
        double r15959555 = 4.0;
        double r15959556 = r15959554 * r15959555;
        double r15959557 = r15959544 * r15959544;
        double r15959558 = r15959557 - r15959556;
        double r15959559 = sqrt(r15959558);
        double r15959560 = r15959559 - r15959544;
        double r15959561 = r15959556 / r15959560;
        double r15959562 = 1.0;
        double r15959563 = 2.0;
        double r15959564 = r15959563 * r15959553;
        double r15959565 = r15959562 / r15959564;
        double r15959566 = r15959561 * r15959565;
        double r15959567 = -3.2455017221486005e-102;
        bool r15959568 = r15959544 <= r15959567;
        double r15959569 = 1.6548685655113915e+96;
        bool r15959570 = r15959544 <= r15959569;
        double r15959571 = -r15959544;
        double r15959572 = r15959571 - r15959559;
        double r15959573 = r15959572 / r15959563;
        double r15959574 = r15959573 / r15959553;
        double r15959575 = r15959544 / r15959553;
        double r15959576 = r15959547 * r15959575;
        double r15959577 = r15959570 ? r15959574 : r15959576;
        double r15959578 = r15959568 ? r15959550 : r15959577;
        double r15959579 = r15959552 ? r15959566 : r15959578;
        double r15959580 = r15959546 ? r15959550 : r15959579;
        return r15959580;
}

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 4 regimes
  2. if b < -4.050400227132123e+61 or -1.8286336308530574e-44 < b < -3.2455017221486005e-102

    1. Initial program 54.3

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

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

    if -4.050400227132123e+61 < b < -1.8286336308530574e-44

    1. Initial program 45.0

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

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

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

      \[\leadsto \frac{\frac{0 + 4 \cdot \left(a \cdot c\right)}{\color{blue}{\sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)} - b}}}{2 \cdot a}\]
    6. Using strategy rm
    7. Applied div-inv15.7

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

    if -3.2455017221486005e-102 < b < 1.6548685655113915e+96

    1. Initial program 12.5

      \[\frac{\left(-b\right) - \sqrt{b \cdot b - 4 \cdot \left(a \cdot c\right)}}{2 \cdot a}\]
    2. Using strategy rm
    3. Applied associate-/r*12.5

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

    if 1.6548685655113915e+96 < b

    1. Initial program 46.2

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \le -4.050400227132123126450622263167578574691 \cdot 10^{61}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le -1.828633630853057376541934728602446135539 \cdot 10^{-44}:\\ \;\;\;\;\frac{\left(c \cdot a\right) \cdot 4}{\sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4} - b} \cdot \frac{1}{2 \cdot a}\\ \mathbf{elif}\;b \le -3.245501722148600476612050122411453201185 \cdot 10^{-102}:\\ \;\;\;\;-1 \cdot \frac{c}{b}\\ \mathbf{elif}\;b \le 1.65486856551139146661393840138316932172 \cdot 10^{96}:\\ \;\;\;\;\frac{\frac{\left(-b\right) - \sqrt{b \cdot b - \left(c \cdot a\right) \cdot 4}}{2}}{a}\\ \mathbf{else}:\\ \;\;\;\;-1 \cdot \frac{b}{a}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (a b c)
  :name "NMSE p42, negative"
  :pre (and (>= (* b b) (* 4.0 (* a c))) (!= a 0.0))
  (/ (- (- b) (sqrt (- (* b b) (* 4.0 (* a c))))) (* 2.0 a)))